Hello Guys,
When applying physics forces on the sample Sinbad model I’m having two issues:
- The various geometries are separated from each other (upper body, legs, cloth etc.) so now it doesn’t behave like one entity.
- The chase camera stops following Sinbad
Here is a clip showing the problem
Here is the code which I’m using to add Sinbad’s geometries to the physics app state:
SceneGraphVisitor visitor = new SceneGraphVisitor() {
@Override
public void visit(Spatial spatial) {
if(spatial instanceof Geometry) {
Geometry geometry = (Geometry)spatial;
CollisionShape shape = CollisionShapeFactory.createDynamicMeshShape(geometry);
//shape.setMargin(0.01f);
shape.setScale(scale);
RigidBodyControl collisionControl = new RigidBodyControl(shape, 1f);
//collisionControl.setKinematic(true);
geometry.addControl(collisionControl);
String geoKey=modelName+"~"+geometry.getName();
geometry.setName(geoKey);
geoName2ModelName.put(geoKey,modelName);
bulletAppState.getPhysicsSpace().add(collisionControl);
ctls.add(collisionControl);// cache control
}
}
};
model.breadthFirstTraversal(visitor);