Gravity on a tube

Post Reply
graetzer
Posts: 1
Joined: Tue Apr 23, 2013 5:22 pm

Gravity on a tube

Post by graetzer »

I am developing a racing game that will look similar to this video:

https://www.youtube.com/watch?v=uQwn7Ufypqo
Image

Basically I need to simulate a gravitational force that pushes object towards the tube
What would be the best way to accomplish this with bullet?

thanks for your help!
norbie
Posts: 21
Joined: Mon Feb 11, 2013 1:57 pm

Re: Gravity on a tube

Post by norbie »

I do not know if I understand the original problem correctly, but if all you need is dynamically changing gravity then could use the setGravity function of btRigidBody in every step before (or after) every stepSimulation. At this point you can retrieve the position of your car or plane with e.g. btRigidBody::getCenterOfMassPosition, you should also be able to determine to position of the center of the tube where your car or plane is. Subtracting former from later (and maybe normalizing the result) gives you the direction of the gravity vector. If you need some special gravity acceleration value you can also multiply the result with a scalar and then you can use btRigidBody::setGravity function to update the gravity acceleration of your car or plane.
Post Reply