CHAI3DCHAI3D

normal dynamically create and remove objects

More
02 May 2017 15:30 #1

is it possible to dynamically create or to remove objects in the scene?


For example, I have a mesh_sphere created at the beginning.
If I press "2", then two ODE shperes will be created with its imageModel set as mesh_sphere;
Then if I press "1", one of the ODE sphere will be removed from the scene;

Please Log in or Create an account to join the conversation.

More
14 May 2017 21:50 #2

You should be able to remove them from the scene. Since this framework uses the ODE dynamics engine, please check the ODE documentation if you are encountering problems.

Please Log in or Create an account to join the conversation.

More
15 May 2017 16:30 #3

Here is my solution to a similar problem:

// Show an object and activate it (or not)
void activate_object(cODEGenericBody* ODEObject, bool activate)
{
if (activate)
{
ODEObject->setEnabled(true,true);
ODEObject->enableDynamics();
ODEObject->setGhostEnabled(false);
}
else
{
ODEObject->setGhostEnabled(true);
ODEObject->disableDynamics();
ODEObject->setEnabled(false,true);
};
}

Please Log in or Create an account to join the conversation.

More
22 May 2019 13:24 #4


Hi, I have a similar issue and this solution doesn't work. For some reason the ODEObject is only removed graphically, NOT haptically. I've also looked through the ODE documentation and I have been unable to find a way to remove ODEobjects from my scene.

If anyone can provide more details on how they were able to remove ODEobjects from their scene I would appreciate it.

Please Log in or Create an account to join the conversation.

More
22 May 2019 13:42 #5

Also, my ODEObjects are set to createDynamicMesh = true. They are static. Testing it as false (moveable object on the scene), lets me disable it haptically and graphically.

So, how do I do this when the object is static? Can I? Do I have to rebuild my code to use a different approach?

Please Log in or Create an account to join the conversation.