Hey Guys,
I have two (related) problems:
a) When I animate a character, the ray casts still have the initial model.
Is it possible to simply update the shape after each frame? Or only (and possibly the best) once the animation is complete?
b) When I simply use spatial.move() on a submesh to move the walls, the collisionshape seems to be the old one.
Can I recalculate it aswell?
Edit: I tried CollisionShapeFactory.createMeshShape(worldSpatial);
on both: The SubGeometry or the whole world. Using the debug-mode I can see that the mesh shape isn’t updated though.
Any suggestions?
And a): Will that take the animation into account?
Edit2:
Sorry for that confusing post. I’ve made some progress right now.
One needs worldSpatial.getControl(RigidBodyControl.class).setCollisionShape(CollisionShapeFactory.createMeshShape(worldSpatial));
to actually update the CollisionShape.
The Problem is: This is recalculating the Shape for the whole level which is cpu-intensive.
There is the CSF.shiftCompoundShapeContents but since the SubMesh does not contain a RigidBodyControl I am uncertain how to set the CollisionShape or how to recalculate that sub-shape?
Edit3:
Aditionally, if I remove a submesh using .removefromParent() I get a nullPointerException
at com.bulletphysics.collision.shapes.CompoundShape.getChildShape(CompoundShape.java:113)
Potentionally because that Node isn’t there any longer.
Do I need to remove the Shape somehow?