Loading models and NullPointer (3 posts)

  • Profile picture of rowanberry rowanberry said 3 months, 3 weeks ago:

    Hi. So far I was very happy with JME3 and then i got this problem:

    I am loading some spatial object:

    Spatial wall_inside_obj = assetManager.loadModel(“Models/wall.obj”);

    Display is fine but when I want to add it to bullet:

    RigidBodyControl wall_rigidb;

    com.jme3.bullet.collision.shapes.CollisionShape wallShape =
    CollisionShapeFactory.createMeshShape((Node) wall_inside_obj );
    wall_rigidb = new RigidBodyControl(wallShape, 0);
    wall_inside_obj.addControl(wall_rigidb);
    *null pointer –> bulletAppState.getPhysicsSpace().add((wall_rigidb);

    I got a NullPointerException.

  • Profile picture of wezrule wezrule201p said 3 months, 3 weeks ago:

    maybe bulletAppState is null?

  • Profile picture of rowanberry rowanberry said 3 months, 3 weeks ago:

    Yes, it is it.

    Thanks!