Gravity in c++ March 10, 2010 12:39AM | Registered: 15 years ago Posts: 444 |
Re: Gravity in c++ March 10, 2010 02:46AM | Registered: 15 years ago Posts: 175 |
Re: Gravity in c++ March 10, 2010 03:56AM | Registered: 15 years ago Posts: 444 |
Re: Gravity in c++ March 10, 2010 04:32AM | Registered: 14 years ago Posts: 121 |
Re: Gravity in c++ March 11, 2010 12:03AM | Registered: 15 years ago Posts: 444 |
Re: Gravity in c++ March 11, 2010 01:30AM | Registered: 15 years ago Posts: 703 |
Re: Gravity in c++ March 11, 2010 10:39AM | Registered: 14 years ago Posts: 379 |
Not entirely true. In the source repository there is Contributions/Enhancements/Controllers/b2GravityController which can be used to do what he wants.Quote
scanffQuote
g_man
I thought I read somewhere that box2d wasn't very good for the type of gravity i'm tring to implement. Also, I'm tring to use this as a learning experience. Thanks though
Yes Box2D will not help you with this.
Re: Gravity in c++ March 11, 2010 05:42PM | Registered: 15 years ago Posts: 703 |
Quote
DaidNot entirely true. In the source repository there is Contributions/Enhancements/Controllers/b2GravityController which can be used to do what he wants.Quote
scanffQuote
g_man
I thought I read somewhere that box2d wasn't very good for the type of gravity i'm tring to implement. Also, I'm tring to use this as a learning experience. Thanks though
Yes Box2D will not help you with this.
The latest sources contain a lot more features then the released 2.0.1 version.
Re: Gravity in c++ March 12, 2010 12:10AM | Registered: 15 years ago Posts: 444 |
Re: Gravity in c++ March 16, 2010 05:38AM | Registered: 15 years ago Posts: 444 |
float speedX; float speedY; float accelX; float accelY; accelX = accel*cos(accelAng); accelY = accel*sin(accelAng); speedX = speed*cos(angle); speedY = speed*sin(angle); speedX+= accelX; speedY+= accelY; speed = sqrt(speedX*speedX+speedY*speedY); angle = asin(speedY/speed); if(speedX<0) angle=(M_PI/2+(M_PI/2-angle)); X+=speed*(cos(angle)); Y+=speed*(sin(angle+M_PI));Tell me if you have any suggestions.