jPCT-AE - a 3d engine for Android > Bugs

Calling Object3D.cloneObject() causes NullPointerException

(1/1)

QuirB:
Trying to clone an Object3D causes a NullPointerException. The object on which cloneObject() is called is definitely not null itself (see stacktrace below).
The strange thing is, the very same object is beeing cloned multiple times at an earlier stage of the game without any problems. Am I missing something, wich causes this behavior?

Device:
Samsung Galaxy TabPRO 10 (SM-T520)
Android 4.4.2 (KitKat)



--- Code: ---05-29 01:33:46.491: E/AndroidRuntime(14875): FATAL EXCEPTION: GLThread 61362
05-29 01:33:46.491: E/AndroidRuntime(14875): Process: minigame.earthdefender, PID: 14875
05-29 01:33:46.491: E/AndroidRuntime(14875): java.lang.NullPointerException
05-29 01:33:46.491: E/AndroidRuntime(14875): at com.threed.jpct.Object3D.copy(Object3D.java:723)
05-29 01:33:46.491: E/AndroidRuntime(14875): at com.threed.jpct.Object3D.<init>(Object3D.java:698)
05-29 01:33:46.491: E/AndroidRuntime(14875): at com.threed.jpct.Object3D.cloneObject(Object3D.java:2552)
05-29 01:33:46.491: E/AndroidRuntime(14875): at minigame.earthdefender.weapons.Bullet.<init>(Bullet.java:16)
05-29 01:33:46.491: E/AndroidRuntime(14875): at minigame.earthdefender.weapons.ProjectilePool.fireBullet(ProjectilePool.java:99)
05-29 01:33:46.491: E/AndroidRuntime(14875): at minigame.earthdefender.weapons.AttackQueue.dequeueAttack(AttackQueue.java:84)
05-29 01:33:46.491: E/AndroidRuntime(14875): at minigame.earthdefender.state.Running.launchProjectiles(Running.java:64)
05-29 01:33:46.491: E/AndroidRuntime(14875): at minigame.earthdefender.state.Running.onUpdate(Running.java:35)
05-29 01:33:46.491: E/AndroidRuntime(14875): at minigame.earthdefender.state.GameState.update(GameState.java:138)
05-29 01:33:46.491: E/AndroidRuntime(14875): at minigame.earthdefender.render.SmartRenderer.onDrawFrame(SmartRenderer.java:90)
05-29 01:33:46.491: E/AndroidRuntime(14875): at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1531)
05-29 01:33:46.491: E/AndroidRuntime(14875): at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1248)
--- End code ---

EgonOlsen:
You can't clone stripped objects. If you are using strip on a cloned object that shares the mesh with the one that should be cloned, you can call setLocked on the initial object's mesh to prevent the mesh from being stripped.

QuirB:
Thanks for the fast response. Problem is solved.

EgonOlsen:
....i should mention it in the docs.... ;)

Navigation

[0] Message Index

Go to full version