Physics problem

Hello Guys,
When applying physics forces on the sample Sinbad model I’m having two issues:

  1. The various geometries are separated from each other (upper body, legs, cloth etc.) so now it doesn’t behave like one entity.
  2. 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() {

        public void visit(Spatial spatial) {
            if(spatial instanceof Geometry) {
                Geometry geometry = (Geometry)spatial;
                CollisionShape shape = CollisionShapeFactory.createDynamicMeshShape(geometry);
                RigidBodyControl collisionControl = new RigidBodyControl(shape, 1f);
                String geoKey=modelName+"~"+geometry.getName();
                ctls.add(collisionControl);// cache control

1 Like

The Sinbad model consists of 7 geometries, each with its own Mesh. Your SceneGraphVisitor creates a physics body for each Geometry, and there’s nothing in the physics to hold them together. The physics doesn’t know about bone animations, and the SkeletonControl that performs the skinning doesn’t know about the physics.

In order to make physics and animation talk to one another, you need a specialized physics control, such as KinematicRagdollControl or DynamicAnimControl.

1 Like

Thank you Stephen. Do you recommend using Minie for solving this issue?

1 Like

Can you use a node and attach the control to it instead?

The model is then just used for visuals/animations and goes along for the ride.

1 Like

In order to use DynamicAnimControl, you’d either have to use Minie or JME 3.3-alpha; DynamicAnimControl doesn’t exist in JME 3.2.x .

If you’re using JME 3.2.x and don’t want to deal with an external library, then KinematicRagdollControl should work fine.

Thanks, I’m in the process of replacing JME bullet libs with Minie. I have just noticed that JDK 8 and above is needed for Minie.

1 Like