Author Topic: Strange rotation behavior?  (Read 2647 times)

Offline Kernle 32DLL

  • byte
  • *
  • Posts: 20
    • View Profile
Strange rotation behavior?
« on: April 01, 2011, 09:57:56 pm »
Hi,

I recently stumnled across something very very strange. I started to load meshes via the Loader class, but the loaded meshes were loaded/rendered turned 180°. So I thought "oh well, lets turn them 180° back then". That led to something a lot more weird. It seemd like, the object was moving its rotation center while beeing rotated, or was wrong all along. In the modelling program, the model is build around the exact center of the mesh, so I would have tought it would rotate around that as well. Anyhow, the result can be seen as the attached pictures.

The way i rotate my object is as follows:

Code: [Select]
mWorldObject.clearRotation();
mWorldObject.rotateY((float)Math.toRadians(180.0f));

The problem can be caused by a constant rotation with 1° without the clearRotation call as well, so it's not that.

Any ideas?

So long,
Kernle

Edit: Oh, that photo of the modelling program is outdated. Think of everything beeing rotatet 90°, so that the front of the submarine is pointing to the right.

[attachment deleted by admin]
« Last Edit: April 01, 2011, 10:00:19 pm by Kernle 32DLL »

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Strange rotation behavior?
« Reply #1 on: April 01, 2011, 10:23:17 pm »
jPCT calculates a rotation pivot when calling build(). This pivot is based ob the object's geometry and not taken from the 3ds. If its not good for a specific model, you can set it yourself by using setRotationPivot().

Offline Kernle 32DLL

  • byte
  • *
  • Posts: 20
    • View Profile
Re: Strange rotation behavior?
« Reply #2 on: April 01, 2011, 11:03:08 pm »
Yep, that did the trick. Thanks again