0
votes

OK, I want to try this:

  1. Make two cars (with sprites: e.g. red rectangle for car 1 texture, green rectangle for car 2 texture). With width: 32px and height: 20px. (Movement of the cars are not the problem)

  2. Then check collision detection like in the picture. The first is front crash and the second is side crash. collision http://img802.imageshack.us/img802/2934/rectangles2.png

  3. Then delete the sprites and only hold the vectors in the code. (position and rotation) I want it so, because I want to add 3d Cars at these positions with his rotations. I mean, Collision detection without sprites in 2d.

In the end game, there will be no sprites. Only 3d Objects.

Anybody has some codes for that?

I want to make it without Box2D. But when there is a good box 2d example. Then I can make it with box2d.

Thank You for any help.

1

1 Answers

2
votes

Well if you want to do collision detection I would just use the included box2d. Have a look at Box2d Car Physics, this will give you a good starting point on how to build up the car.The code is for C however because LibGDX is a wrapper all methods that are demonstrated in the tutorial are available. If you need help setting up the box2d physics in libgdx the wiki is very good. To get started building your engine you should just use the box2d debugger provided with libgdx, This just draws all shapes (box/circle/polygon) then once your happy with the behaivour of your engine, you can just change the rendering code and use the X,Y positions and rotation of your car and use your 3d models.