Author Topic: Tilt an Object3D as reaction to a collision  (Read 782 times)

Offline lui1000

  • byte
  • *
  • Posts: 1
    • View Profile
Tilt an Object3D as reaction to a collision
« 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.

Online EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11776
    • View Profile
    • http://www.jpct.net
Re: Tilt an Object3D as reaction to a collision
« Reply #1 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.