Custom mesh flipping out

Hello,

My project is reaching it’s final development stages… but I ran into a quite big problem at the end of the road.



At the above image you can see a sample of my multiplayer game. Everything mostly works fine but sometimes when i’m removing blocks from my terrain I get these kind of malformed meshes. My terrain is split up into 16x16x16 parts so only the part that I have updated will have the weird effect on it. I have no idea where it can possibly come from.

Is this maybe a known bug or anything that I might have forgotten to take into account?

I can provide the code if needed, although it’s quite a lot…



Edit: This event doesn’t generate any errors or anything else. When I update the mesh again (through placing a block or removing one) the mesh shape is fine again.

Try to set face cull to off and see if it helps. If yes, then you are doing some of the triangles wrong way (clockwise versus counterclockwise). Probably your update routine is slightly different in this aspect from your creation routine, thus the error appearing only after the update.

It looks like your indices are messed up or some vertices are missing.

Finally managed to get some errors out of it… can’t really make much out of it though. Maybe you guys see it…



Seems to be happening when i’m removing my meshcollisionshape on the old mesh and creating a new meshcollisionshape on the new one?



23-mei-2011 18:36:12 com.jme3.bullet.BulletAppState postRender

SEVERE: null

java.util.concurrent.ExecutionException: java.lang.NullPointerException

at java.util.concurrent.FutureTask$Sync.innerGet(FutureTask.java:222)

at java.util.concurrent.FutureTask.get(FutureTask.java:83)

at com.jme3.bullet.BulletAppState.postRender(BulletAppState.java:197)

at com.jme3.app.state.AppStateManager.postRender(AppStateManager.java:185)

at com.jme3.app.SimpleApplication.update(SimpleApplication.java:260)

at com.jme3.system.lwjgl.LwjglAbstractDisplay.runLoop(LwjglAbstractDisplay.java:143)

at com.jme3.system.lwjgl.LwjglDisplay.runLoop(LwjglDisplay.java:171)

at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:217)

at java.lang.Thread.run(Thread.java:662)

Caused by: java.lang.NullPointerException

at com.bulletphysics.collision.dispatch.SimulationIslandManager.buildIslands(SimulationIslandManager.java:146)

at com.bulletphysics.collision.dispatch.SimulationIslandManager.buildAndProcessIslands(SimulationIslandManager.java:240)

at com.bulletphysics.dynamics.DiscreteDynamicsWorld.solveConstraints(DiscreteDynamicsWorld.java:641)

at com.bulletphysics.dynamics.DiscreteDynamicsWorld.internalSingleStepSimulation(DiscreteDynamicsWorld.java:385)

at com.bulletphysics.dynamics.DiscreteDynamicsWorld.stepSimulation(DiscreteDynamicsWorld.java:339)

at com.jme3.bullet.PhysicsSpace.update(PhysicsSpace.java:342)

at com.jme3.bullet.PhysicsSpace.update(PhysicsSpace.java:329)

at com.jme3.bullet.BulletAppState$2.call(BulletAppState.java:102)

at com.jme3.bullet.BulletAppState$2.call(BulletAppState.java:99)

at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)

at java.util.concurrent.FutureTask.run(FutureTask.java:138)

at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:98)

at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:206)

at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)

… 1 more

Does the visual artifact or exception still happen when you disable physics?

I think that error is a result of some problem before. The MeshCollisionShape expects a properly set up mesh made from triangles. So this is actually another hint that your index/vertex data is messed up.

Disabled the physics and I didn’t get any of these malformed meshes.



Guessing I have to look into the lines where I add my mesh to the physics space.

No you have to look at the lines where the mesh is assembled. It has nothing to do with physics, thats just when you recognize it for the first time because the malformed mesh is causing an exception in the physics collision detection.

take a look at your private inbox diet666 :wink:

check the inbox again :slight_smile: