NullPointerException in collision checking

Started by kiffa, April 19, 2013, 05:38:51 AM

Previous topic - Next topic

kiffa

codes:

mObject3d.checkForCollisionSpherical(step, r);

Exception:

04-19 01:31:19.280: E/AndroidRuntime(3243):       java.lang.NullPointerException
04-19 01:31:19.280: E/AndroidRuntime(3243): at com.threed.jpct.Object3D.collideSpherical(Object3D.java:4284)
04-19 01:31:19.280: E/AndroidRuntime(3243): at com.threed.jpct.World.checkSomeCollisionSpherical(World.java:1650)
04-19 01:31:19.280: E/AndroidRuntime(3243): at com.threed.jpct.World.checkObjCollisionSpherical(World.java:1275)
04-19 01:31:19.280: E/AndroidRuntime(3243): at com.threed.jpct.Object3D.checkForCollisionSpherical(Object3D.java:2865)
04-19 01:31:19.280: E/AndroidRuntime(3243): at com.zwenyu.woo3d.entity.ComMove.checkCollision(ComMove.java:130)
04-19 01:31:19.280: E/AndroidRuntime(3243): at com.zwenyu.woo3d.entity.ComAI.tryMove2(ComAI.java:54)
04-19 01:31:19.280: E/AndroidRuntime(3243): at com.zwenyu.woo3d.entity.ComAI.update(ComAI.java:173)
04-19 01:31:19.280: E/AndroidRuntime(3243): at com.zwenyu.woo3d.entity.GameEntity.update(GameEntity.java:144)
04-19 01:31:19.280: E/AndroidRuntime(3243): at com.zwenyu.woo3d.entity.GameEntityManager.updateAllEntities(GameEntityManager.java:60)
04-19 01:31:19.280: E/AndroidRuntime(3243): at com.zwenyu.woo3d.scene.Scene3D.onLoop(Scene3D.java:209)



Others: 
Hard to reappear the exception. I use octree for collision.

EgonOlsen

jPCT-AE isn't thread safe. Do not use any thread except for the rendering thread to work on jPCT-AE related instances (unless you synchronize it with the rendering).

kiffa

Thanks, you are right.

I handled the  collision checking in the method of View.onToch()(for picking) which was running in the UI Thread. Now i corrected this problem.