Physic and 3D Model - Model fall on the floor AND! suddenly straighten up?!

I loaded a model, actually a gun, which drops now to the floor.

Of course the gun landing on the side, like every nice gun should do!^^

Afterwards the gun straighten up and return to it's "normal" position (in this position the gun is falling)

The funny thing is, that the gun is shaking from one side to the other, before reaching it's end position(standing without falling forward)



Thanks for help

its probably the surrounding boundingbox which makes it behave funny.

Try to create better fitting boundingboxes, so the physical representation is more like the visual model.

Or create trimesh accurate physics with DynamicPhysicsNode.generatePhysics(true)

If I use DynamicPhysicsNode.generatePhysics(true) the programm is killing itself.



I get an



ODE INTERNAL ERROR 2



invalid operation for locked space (ode/scr/collision_space.cpp:690)





And the javaw.exe is killing istself.

Sounds like the gun is inside another physical representation. Are you sure the OTHER objects in the scene are bounded correctly? If you're using something like SimpleGame, try pressing "b" to see the bounds. And in the render() call, you can also use PhysicsDebugger.drawPhysics(physicsSpace, getRenderer()) to draw the physical bounds. Take a look at those, you'll probably be able to solve your problem then.



EDIT: By the way, if you're moving your gun manually, make sure you're using update callbacks, instead of just doing something like gun.setLinearVelocity() (and especially gun.getLocalTranslation().x = …), because that can make the updates out of sync with the physics (they can update faster/slower than the graphics).



Another EDIT: It could also be that there are some funky polygons imported with the gun way over where they shouldn't be (making the model's bounding volume huge, and giving the generatePhysics(true) call so much trouble). So it might be a good idea to check your model.

You might want to give resting a try (I believe you would just set the object at rest once it reaches the floor)…

Sorry for my late answer.

University can stress sometime.



With your help I got it work.

It's not perfect, but the gun doesn't make strange moves.

Thanks for your help!