Problem with example of rollmadness game

hello, everyone.



I am follow the tutorial of rollmadness and I have a problem with the physics of the tutorial after create a PhysicsNode using that shape. The model does not collide, only falls and falls, I’m using the plugins of ogre.



the code is:



/*

  • To change this template, choose Tools | Templates
  • and open the template in the editor.

    */



    package mygame;



    import com.jme3.app.SimpleBulletApplication;

    import com.jme3.asset.plugins.UrlLocator;

    import com.jme3.bullet.collision.shapes.CollisionShape;

    import com.jme3.bullet.collision.shapes.SphereCollisionShape;

    import com.jme3.bullet.nodes.PhysicsNode;

    import com.jme3.bullet.util.CollisionShapeFactory;

    import com.jme3.light.DirectionalLight;

    import com.jme3.math.ColorRGBA;

    import com.jme3.math.Quaternion;

    import com.jme3.math.Vector3f;

    import com.jme3.renderer.RenderManager;

    import com.jme3.renderer.ViewPort;

    import com.jme3.scene.Geometry;

    import com.jme3.scene.Node;

    import com.jme3.scene.Spatial;

    import com.jme3.scene.control.AbstractControl;

    import java.util.ArrayList;

    import java.util.LinkedList;

    import com.jme3.scene.control.Control;

    import mygame.sceneparser.SceneObject;

    import mygame.sceneparser.SceneObjectGenerator;

    import mygame.sceneparser.SceneObjectMap;

    import mygame.sceneparser.SceneObjectMapImpl;



    /**

    *
  • @author sergio

    */

    public class Basic extends SimpleBulletApplication

    {

    private final int MAX_CUBE = 50;

    public static void main(String[] args)

    {

    new Basic().start();

    }



    @Override

    public void simpleInitApp()

    {

    Spatial scene = assetManager.loadModel(“Scenes/basic.j3o”);



    SceneObjectGenerator gen = new SceneObjectGenerator();

    gen.setIgnoreCase(true);



    SceneObjectMapImpl objects = gen.generate(scene, “player”,“Plano”);

    SceneObject player = objects.getFirstOf(“player”);

    if(player != null)

    {

    Spatial spatial = player.getWrappedSpatial();

    spatial.updateGeometricState();

    cam.setFrame(spatial.getWorldTranslation(), spatial.getWorldRotation());

    player.detach();

    }



    for(SceneObject e: objects.getSceneObjects(“Plano”))

    {

    if(e.getWrappedSpatial() instanceof Geometry)

    {

    e.detach();

    CollisionShape cs = CollisionShapeFactory.createMeshShape(e.getWrappedSpatial());

    PhysicsNode pn = new PhysicsNode(e.getWrappedSpatial(),cs,0);

    e.getSpatialParent().attachChild(pn);

    e.reattach();

    getPhysicsSpace().add(pn);

    }

    }



    CollisionShape playerShape = new SphereCollisionShape(2f);

    final PhysicsNode playerNode = new PhysicsNode(playerShape, 1);

    playerNode.setLocalRotation(cam.getRotation().clone());

    playerNode.setLocalTranslation(cam.getLocation().clone());

    getPhysicsSpace().add(playerNode);

    getRootNode().attachChild(playerNode);//same as rootNode.attachChild



    scene.addControl(new AbstractControl()

    {

    protected void controlUpdate(float tpf) {

    cam.setLocation(playerNode.getLocalTranslation());

    }



    protected void controlRender(RenderManager rm, ViewPort vp)

    {

    }



    public Control cloneForSpatial(Spatial spatial)

    {

    return (Control)this;

    }

    });



    Vector3f initialPush = playerNode.getLocalRotation().

    multLocal(new Vector3f(0, 1, 0));

    playerNode.setLinearVelocity(initialPush);



    rootNode.attachChild(scene);

    }

    }



    please help.