BUGS: PhysicsCylinder, Cylinder, and Tube acting strangely in collisions

First PhysicsCylinder fails to collide with other physics cylinders



Example:


import java.util.logging.Level;
import java.util.logging.Logger;

import com.jme.math.FastMath;
import com.jme.math.Quaternion;
import com.jme.scene.Text;
import com.jmex.physics.DynamicPhysicsNode;
import com.jmex.physics.StaticPhysicsNode;
import com.jmex.physics.util.SimplePhysicsGame;

public class TestPhysicsCylinders extends SimplePhysicsGame {

    protected void simpleInitGame()
    {
        DynamicPhysicsNode dynamicCylinder = getPhysicsSpace().createDynamicNode();
        dynamicCylinder.createCylinder("dynamic cylinder");
        dynamicCylinder.setLocalTranslation(0, 30, 0);
       
        StaticPhysicsNode staticCylinder = getPhysicsSpace().createStaticNode();
        staticCylinder.createCylinder("static cylinder");
        staticCylinder.setLocalTranslation(0, -5, 0);
        staticCylinder.setLocalRotation(new Quaternion().fromAngles(FastMath.HALF_PI, 0 , 0));
        staticCylinder.setLocalScale(5);
       
        showPhysics=true;
        pause = true;

        Text label = Text.createDefaultTextLabel( "instructions", "Press P to release pause." );
        label.setLocalTranslation( 0, 20, 0 );
        statNode.attachChild( label );
    }

    public static void main( String[] args ) {
        Logger.getLogger( "" ).setLevel( Level.WARNING ); // to see the important stuff
        new TestPhysicsCylinders().start();
    }
}



secondly Cylinders when used as physics meshes cause unbelievably large bounces on collision even when set to the least bouncy material concrete

Example:


import java.util.logging.Logger;

import com.jme.math.FastMath;
import com.jme.math.Quaternion;
import com.jme.math.Vector3f;
import com.jme.scene.Text;
import com.jme.scene.shape.Cylinder;
import com.jmex.physics.DynamicPhysicsNode;
import com.jmex.physics.StaticPhysicsNode;
import com.jmex.physics.material.Material;
import com.jmex.physics.util.SimplePhysicsGame;

public class TestPhysicsMeshCylinders extends SimplePhysicsGame {

    protected void simpleInitGame()
    {
        DynamicPhysicsNode dynamicCylinder = getPhysicsSpace().createDynamicNode();
        Cylinder c = new Cylinder("cylinder", 10, 10, 1, 1, true);
        dynamicCylinder.attachChild(c);
        dynamicCylinder.setMaterial(Material.CONCRETE);
        dynamicCylinder.generatePhysicsGeometry(true);
        dynamicCylinder.setLocalTranslation(1, 5, 0);
        rootNode.attachChild(dynamicCylinder);
       
        DynamicPhysicsNode dynamicCylinder2 = getPhysicsSpace().createDynamicNode();
        Cylinder d = new Cylinder("cylinder", 10, 10, 1, 1, true);
        dynamicCylinder2.attachChild(d);
        dynamicCylinder2.setMaterial(Material.CONCRETE);
        dynamicCylinder2.generatePhysicsGeometry(true);
        dynamicCylinder2.setLocalTranslation(0, -5, 0);
        dynamicCylinder2.setLocalScale(2);
        rootNode.attachChild(dynamicCylinder2);
       
        StaticPhysicsNode floor = getPhysicsSpace().createStaticNode();
        floor.createBox("static floor");
        floor.setLocalTranslation(0, -10, 0);
        floor.setLocalRotation(new Quaternion().fromAngles(FastMath.HALF_PI, 0 , 0));
        floor.setLocalScale(new Vector3f(20, 20, 1));
       
       
        showPhysics=true;
        pause = true;

        Text label = Text.createDefaultTextLabel( "instructions", "Press P to release pause." );
        label.setLocalTranslation( 0, 20, 0 );
        statNode.attachChild( label );
    }

    public static void main( String[] args ) {
        Logger.getLogger( "" ).setLevel( Level.WARNING ); // to see the important stuff
        new TestPhysicsMeshCylinders().start();
    }
}



Lastly Tubes have the same problem as Cylinders as physics meshes

Example:


import java.util.logging.Level;
import java.util.logging.Logger;

import com.jme.math.FastMath;
import com.jme.math.Quaternion;
import com.jme.math.Vector3f;
import com.jme.scene.Text;
import com.jme.scene.shape.Tube;
import com.jmex.physics.DynamicPhysicsNode;
import com.jmex.physics.StaticPhysicsNode;
import com.jmex.physics.material.Material;
import com.jmex.physics.util.SimplePhysicsGame;

public class TestPhysicsMeshTube extends SimplePhysicsGame {

    protected void simpleInitGame()
    {
        DynamicPhysicsNode dynamicTube = getPhysicsSpace().createDynamicNode();
        Tube c = new Tube("tube", 1, 0, 1);
        dynamicTube.attachChild(c);
        dynamicTube.setMaterial(Material.CONCRETE);
        dynamicTube.generatePhysicsGeometry(true);
        dynamicTube.setLocalTranslation(1, 5, 0);
        rootNode.attachChild(dynamicTube);
       
        DynamicPhysicsNode dynamicTube2 = getPhysicsSpace().createDynamicNode();
        Tube d = new Tube("tube", 1, 0, 1);
        dynamicTube2.attachChild(d);
        dynamicTube2.setMaterial(Material.CONCRETE);
        dynamicTube2.generatePhysicsGeometry(true);
        dynamicTube2.setLocalTranslation(0, -5, 0);
        dynamicTube2.setLocalScale(2);
        rootNode.attachChild(dynamicTube2);
       
        StaticPhysicsNode floor = getPhysicsSpace().createStaticNode();
        floor.createBox("static floor");
        floor.setLocalTranslation(0, -10, 0);
        floor.setLocalRotation(new Quaternion().fromAngles(FastMath.HALF_PI, 0 , 0));
        floor.setLocalScale(new Vector3f(20, 20, 1));
       
       
        showPhysics=true;
        pause = true;

        Text label = Text.createDefaultTextLabel( "instructions", "Press P to release pause." );
        label.setLocalTranslation( 0, 20, 0 );
        statNode.attachChild( label );
    }

    public static void main( String[] args ) {
        Logger.getLogger( "" ).setLevel( Level.WARNING ); // to see the important stuff
        new TestPhysicsMeshTube().start();
    }
}

you can use a boundingbox, then you don't have to generate triangle accurate physics.


        Tube d = new Tube("tube", 1, 0, 1);
        d.setModelBound(new BoundingBox());
        d.updateModelBound();



it seems cylinder <-> cylinder collision is not supported by ode:
http://www.jmonkeyengine.com/forum/index.php?topic=10211.0