Bullet 2.72
I'm not sure if this is an expected, but I get a crash if I set linear velocity on a Static object.
Thanks,
Jason
btRigidBody::setLinearVelocity on static object asserts
-
- Posts: 7
- Joined: Tue Nov 04, 2008 4:27 pm
-
- Site Admin
- Posts: 4221
- Joined: Sun Jun 26, 2005 6:43 pm
- Location: California, USA
Re: btRigidBody::setLinearVelocity on static object asserts
It is just an assert in debug mode firing off, not a real crash right? If not, what is the call stack?
You can remove the assert, but don't expect the object to move.
The static object won't move when you set its velocity. That is why it is called static. If you want motion, use dynamic or kinematic objects.
We could remove the assert, it would allow to create some interesting interaction due to friction: dynamic objects that touch the static object try to match its velocity. This can be useful for conveyor belts etc.
Thanks,
Erwin
You can remove the assert, but don't expect the object to move.
The static object won't move when you set its velocity. That is why it is called static. If you want motion, use dynamic or kinematic objects.
We could remove the assert, it would allow to create some interesting interaction due to friction: dynamic objects that touch the static object try to match its velocity. This can be useful for conveyor belts etc.
Thanks,
Erwin
-
- Posts: 7
- Joined: Tue Nov 04, 2008 4:27 pm
Re: btRigidBody::setLinearVelocity on static object asserts
Ah yes, thank you Erwin. That does make sense.
My assumption is that the setting of linear velocity would just be zeroed out for static objects in the API. I was just updating objects' motions in the same manner for all objects, assuming that it'd "do the right thing" with Static objects, and I wouldn't have to test for isStaticObject() myself. However, I can see there might be a reason to do the conveyor-belt behaviour for those certain rare times.
Perhaps in idea might be to have a variadic on the function like this: setVelocity( btVector3 v, bool zeroForStaticObjects=true ) ?
Either way, now that I know, I'm happy:)
Jason
My assumption is that the setting of linear velocity would just be zeroed out for static objects in the API. I was just updating objects' motions in the same manner for all objects, assuming that it'd "do the right thing" with Static objects, and I wouldn't have to test for isStaticObject() myself. However, I can see there might be a reason to do the conveyor-belt behaviour for those certain rare times.
Perhaps in idea might be to have a variadic on the function like this: setVelocity( btVector3 v, bool zeroForStaticObjects=true ) ?
Either way, now that I know, I'm happy:)
Jason