Community Forum

removing Physical objects, unlink i3d

Forum Overview >> Scripting

Created10.01.2011 20:24

Simon Broggi (Unknown) 10.01.2011 20:36

I am having some problems removing Physical objects.
I would expect the unlink function to remove everything related to the id I pass on to it, but it just removes the graphics, leaving behind an invisible physic object.

If I remove physical objects by setting theyre rigid body type to "NoRigidBody" then the physical object dosnt seem to disapear propperly either, this shows in the Physics stats and causes the game to crash after a while if lots of objects are created and deleted.

Any solutions?

Stefan Geiger - GIANTS Software 11.01.2011 17:27
Are you sure that the node you use for setting the rigid body type is the physics object, or is it a child of it?

You can use removeFromPhysics(nodeId) to remove it and addToPhysics(nodeId) to add it again.

Simon Broggi (Unknown) 11.01.2011 18:20
ok, I will try the removeFromPhysics function, thanks.

the problem with setRigidBody is not so obvious at first, I've only had problems after removing a lot of them via setRigidBodyType("noRigidBody"), at some point physX mentioned that there were to many objects and it would ignore new ones, which it did.

my main point is actually that I think the unlink function should also remove the objects from Physics, not only from visual rendering. Or is there a reason to do it the way it is done? This is an issue I have ran into several times now. I'll try to write a script function that unlinks the way I would expect it to...

Note: Log in to post. Create a new account here.