How to Cancel gravity

allenshen
Posts: 6
Joined: Mon Jan 28, 2013 2:51 am

How to Cancel gravity

Post by allenshen »

Hi all,I want to set gravity to 0 use dynamicsWorld->setGravity(btVector3(0,0,0));
but it's unuseful :( ,any one knows how to do?
xexuxjy
Posts: 225
Joined: Wed Jan 07, 2009 11:43 am
Location: London

Re: How to Cancel gravity

Post by xexuxjy »

Is it not working?

From what I remember you have to set the world gravity before you add objects to it otherwise they won't get the new value and you'll have to go through and adjust them by hand.
User avatar
godlike
Posts: 20
Joined: Fri Feb 19, 2010 7:09 pm

Re: How to Cancel gravity

Post by godlike »

From what I remember the world's gravity is been copied to every new body you add to the world. Maybe you need to iterate all objects and set the new gravity yourself.
Misterblue
Posts: 14
Joined: Wed Apr 28, 2010 3:09 pm

Re: How to Cancel gravity

Post by Misterblue »

My encounter with gravity was finding that a rigid body's gravity is set to the world's default gravity when it is added to the dynamics world. If you want an individual rigid body to have a different gravity, you must change it after you have added it to the world.