I have this wall, and I can “shoot” it and remove the wall with
rootNode.detachChild(results.getCollision(0).getGeometry());
or
results.getCollision(0).getGeometry().removeFromParent();
But the collision is still there so it’s like an invisible wall now. If I try and do results.getCollision(0).getGeometry().setActive(false); I get an error for the setActive() saying that method doesn’t exist for the geometry.
The wall is created by making a new box, new geometry, then using the CollisionShapeFactory and RigidBodyControl then adding that into the bulletAppState.getPhysicsSpace().add();
Is there another method I need to call to remove it? Or should I be making the wall differently?
Thanks,
~Jeremy
Remove the RigidBodyControl from the physics space or disable it (which does the same).
Is there a way to find a specific RigidBodyControl because I didn’t give it a name or any specific ID? And would it be bulletAppState.getPhysicsSpace.remove(myRigidBodyControl); ?
u can use remove(RigidBodyControl.class), or remove(spatial)
bulletAppState.getPhysicsSpace.remove(mySpatial.getControl(RigidBodyControl.class));
awesome! Thanks!
wezrule said:
u can use remove(RigidBodyControl.class), or remove(spatial)
normen said:
bulletAppState.getPhysicsSpace.remove(mySpatial.getControl(RigidBodyControl.class));
That's the why wezrule not always get thumbs up xD.
to be pedantic then its actually
[java]bulletAppState.getPhysicsSpace().remove(mySpatial.getControl(RigidBodyControl.class));[/java]
Yeah, just passing the spatial does the same really… Just wanted to show this as it seemed jeremy had no idea how to access the RigidBody of a Spatial.
Yeah, I wasn’t sure how to access it, but it helps a lot. My code is actually a bit different, but everything is working now!
bullet_app_state.physics_space.remove(spacial.get_control(RigidBodyControl.java_class))
Thanks