www.jpct.net

jPCT-AE - a 3d engine for Android => Support => Topic started by: lui1000 on March 07, 2013, 07:46:38 pm

Title: Tilt an Object3D as reaction to a collision
Post by: lui1000 on March 07, 2013, 07:46:38 pm
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.
Title: Re: Tilt an Object3D as reaction to a collision
Post by: EgonOlsen on March 07, 2013, 08:28:26 pm
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.