Null pointer exception on collision method in Android 3.1

Hello,

I get a null pointer exception when receiving a collision event on an Android 3.1 device:



java.lang.NullPointerException

Exception thrown in Thread[GLThread 10,5,main]:

at com.jme3.bullet.collision.PhysicsCollisionEvent.getNodeA(-1)

at mygame.FlyingObjectsGame.collision(134)

at com.jme3.bulletPhysicsSpace.distributedEvents(-1)





However, my application works fine on a PC.



The two objects that collide are built as follows. The one that is associated to the null exception (nodeA) is:



Node border_node= new Node(“EGhost”);

c=new GhostControl(box_width);

border_node.addControl©;

border_node.setLocalRotation(…);

this.rootNode.attachChild(border_node);

bulletAppState.getPhysicsSpace().add©;



the second colliding object (nodeB) is:



Geometry object_geo = new Geometry(“object”, active_mesh);

object_geo.setMaterial(active_material);

rootNode.attachChild(object_geo);

object_geo.setLocalTranslation(…);

object_phy = new RigidBodyControl(5f);

object_geo.addControl(object_phy);

bulletAppState.getPhysicsSpace().add(object_phy);

object_phy.setLinearVelocity(shootDir.mult(shootSpeed));



I am using the bullet native version for android. The compilation output says:

Replacing bullet library with android native version.

Expanding: C:…mobilelibsjME3-bullet-natives-android.jar into C:…mobilelibs



Thanks in advance for your help

Hello,

I still have the collision null pointer exception.

how can I force the compiler to use the non-native bullet implementation?

during the build process I get this message:

“Replacing bullet library with android native version.” and the jME3-bullet-natives-android.jar is used

Thanks for your help

hello !



Same bug here on galaxy S2 android native bullet.



For JME3 coders: during my test I simply had a condition if nodeA != null & if nodeB != null in the PhysicCollsiionEvent, and it’s all ok. It doesn’t bug anymore and the collsision are properly handled. Maybe the bug is due to the thread synching at start or something ?



[java]public Spatial getNodeA() {



if (nodeA != null) <- here

if (nodeA.getUserObject() instanceof Spatial) {

return (Spatial) nodeA.getUserObject();

}

return null;

}[/java]



Thanks,



Kine

@Normen what do you think about this?



Should I add this for android?

No wait with that, something else is wrong here, else the same would happen in jbullet.