Pool game [C++]

Discuss issues specific to miscellaneous ports of Box2D
Posts: 5
Joined: Fri Nov 08, 2013 11:33 am

Pool game [C++]

Postby chelneru » Tue Dec 24, 2013 7:56 am

Hi !
I am making a pool game and I have some problems with trajectory line.
What I want to do is drawing a short line that will show where the ball will go after it was hit by the white ball.

For that I found an interesting method. I save the step(). I apply force to the white ball . I go like 400 steps forward . Save the coordinates of the white ball and the ball that made contact with the white ball. I go back to the step saved.

The problem is : how do I do that ?

1. How do I save the Step() ?
2. I thought to identify the objects with collision callbacks or something like that , it's ok ?

If you have another solution to predict the trajectory of the ball I would gladly listen to :D

PS: Sorry for bad english , it's not my native language.

irresistible force
Posts: 1991
Joined: Tue Jun 24, 2008 8:25 pm
Location: Tokyo

Re: Pool game [C++]

Postby irresistible force » Tue Dec 24, 2013 4:11 pm

You can save these for each body, should be ok to restore the state:
- velocity
- angle
- linear velocity
- angular velocity

Return to “Miscellaneous”

Who is online

Users browsing this forum: No registered users and 2 guests