Tilt an Object3D as reaction to a collision

Started by lui1000, March 07, 2013, 07:46:38 PM

Previous topic - Next topic

lui1000

Hi guys,
I am new to jPCT and to this forum and have encountered a problem.

I have created a cube and put it into my World. I have also imported another Object3D from an extern .obj file, what should represent the floor. The cube's movement is controlable like in the collision example in the Wiki.
Basically, I just want to rotate that Cube when it moves across the bumpy floor. It should be rotated depending on how the surface of the floor is.
I tried it through setting up a CollisionListener for my Cube, but I really don't know how to continue. Or is there an even better method to do this?

Regards, lui.

EgonOlsen

You could try to calc the distance between the terrain and the corners of the cube and adjust the cube accordingly. The car example of jPCT's desktop version does something similar.