Hi.
The problem is that if I change the mass of the rigid body from zero (the initial mass) to any other value the rigid body stays static (despite isStaticObject() returns false). Activating the body doesn't help (although isActive() returns true). Apply the force doesn't move the body, gravity doesn't affect it either.
If I create a rigid body with the positive mass I can freely change it to zero and back and forth again.
How to overcome this problem? Thanks in advance.
Changing the mass from 0.0f to any other value.
-
- Posts: 22
- Joined: Fri Jan 14, 2011 7:10 pm
- Location: Ukraine
-
- Posts: 38
- Joined: Thu Jul 08, 2010 12:52 am
Re: Changing the mass from 0.0f to any other value.
Hi,
Sounds familiar, I think the problem is that the object stays in the "static list" even if the mass gets changed. You can fix this by removing the object from the dynamicsworld and then adding it back again..
Sounds familiar, I think the problem is that the object stays in the "static list" even if the mass gets changed. You can fix this by removing the object from the dynamicsworld and then adding it back again..
-
- Posts: 22
- Joined: Fri Jan 14, 2011 7:10 pm
- Location: Ukraine
Re: Changing the mass from 0.0f to any other value.
Thanks for the reply.
Well, it's not the best solution, because this operation takes some time (maybe it's negligible but anyway).
So I wonder is it a bug or a normal behaviour?
Well, it's not the best solution, because this operation takes some time (maybe it's negligible but anyway).
So I wonder is it a bug or a normal behaviour?
-
- Posts: 38
- Joined: Thu Jul 08, 2010 12:52 am
Re: Changing the mass from 0.0f to any other value.
Not sure if it's a bug or not, haven't really looked at the code other than to solve it to that point. Generally speaking rigidbodies don't really "know" anything of the things that use them so having the setmass do something wouldn't work. Anyway, something like remove+add back would probably have to happen internally if the mass was checked for, but then this check would have to be done per rb per simulation step I guess.
-
- Site Admin
- Posts: 4221
- Joined: Sun Jun 26, 2005 6:43 pm
- Location: California, USA
Re: Changing the mass from 0.0f to any other value.
You need to remove a rigid body from the world, before changing the mass (or shape etc), and then re-insert it. This way, the internal structures will be properly updated.
Thanks,
Erwin
Thanks,
Erwin
-
- Posts: 22
- Joined: Fri Jan 14, 2011 7:10 pm
- Location: Ukraine
Re: Changing the mass from 0.0f to any other value.
Kanttori, Erwin
thank you for your replies.
thank you for your replies.