Add/Remove improvement
-
- Posts: 59
- Joined: Thu Aug 31, 2006 11:51 am
Add/Remove improvement
I suggest to improve addRigidBody and removeRigidBody. It would be very nice to return bool result of the function. Return true, if object was actually added/removed. Return false if object already exists (for Add operation) or if object is not in scene (for Remove operation)...................................
-
- Posts: 9
- Joined: Fri Aug 05, 2005 2:59 pm
-
- Site Admin
- Posts: 4221
- Joined: Sun Jun 26, 2005 6:43 pm
- Location: California, USA
-
- Posts: 59
- Joined: Thu Aug 31, 2006 11:51 am
-
- Posts: 9
- Joined: Fri Aug 05, 2005 2:59 pm
It would be better if you kept track of what objects you did add, so that you can remove those.
You should do that in your physics/collision manager.
If the lack of this feature prevents you from using Bullet, you have serious issues in your coding.
If you really want this, and can't wait: Do It Yourself.
You should do that in your physics/collision manager.
If the lack of this feature prevents you from using Bullet, you have serious issues in your coding.
If you really want this, and can't wait: Do It Yourself.
-
- Site Admin
- Posts: 4221
- Joined: Sun Jun 26, 2005 6:43 pm
- Location: California, USA
It's not that easy actually, it would make the API inconsistent:But it's easy to add such feedback, so I'll add it.
The problem is that once you start with such 'improvement' there is no end... to be consistent, all API's should return true/false.
It's best to just do the check on the application side. Why would someone want to delete random things he doesn't know if they are already deleted?
I can help by adding a 'findRigidbody', and you just call that first.
Would that help?
Erwin
-
- Posts: 59
- Joined: Thu Aug 31, 2006 11:51 am
Well...Let's come from other side.Erwin Coumans wrote:It's not that easy actually, it would make the API inconsistent:But it's easy to add such feedback, so I'll add it.
The problem is that once you start with such 'improvement' there is no end... to be consistent, all API's should return true/false.
It's best to just do the check on the application side. Why would someone want to delete random things he doesn't know if they are already deleted?
I can help by adding a 'findRigidbody', and you just call that first.
Would that help?
Erwin
It would be useful if Rigidbody could mantain IN_SCENE flag. You set/reset IN_SCENE flag on add/remove operation. And there will be new method in Rigidbody: bool isInScene(void). Like isStaticObject(), isKinematicObject()....Great?
P.S. Not only me, but you also need this flag. You need it to prevent adding body in several scenes at the same time....
-
- Site Admin
- Posts: 4221
- Joined: Sun Jun 26, 2005 6:43 pm
- Location: California, USA
rigidbody->getBroadphaseHandle() returns non-zero when the body is added to the dynamics/collision world, and 0 when remove/not added.
We can have some bool isInWorld() checking this getBroadphaseHandle.
Does that help?
Erwin
We can have some bool isInWorld() checking this getBroadphaseHandle.
Does that help?
Erwin
Jack wrote: Well...Let's come from other side.
It would be useful if Rigidbody could mantain IN_SCENE flag. You set/reset IN_SCENE flag on add/remove operation. And there will be new method in Rigidbody: bool isInScene(void). Like isStaticObject(), isKinematicObject()....Great?
-
- Posts: 59
- Joined: Thu Aug 31, 2006 11:51 am
Yes. That is OK!
Erwin Coumans wrote:rigidbody->getBroadphaseHandle() returns non-zero when the body is added to the dynamics/collision world, and 0 when remove/not added.
We can have some bool isInWorld() checking this getBroadphaseHandle.
Does that help?
Erwin
Jack wrote: Well...Let's come from other side.
It would be useful if Rigidbody could mantain IN_SCENE flag. You set/reset IN_SCENE flag on add/remove operation. And there will be new method in Rigidbody: bool isInScene(void). Like isStaticObject(), isKinematicObject()....Great?