Author Topic: Store and load rotation objetos3D  (Read 1080 times)

Offline MegasXLS

  • byte
  • *
  • Posts: 29
    • View Profile
Store and load rotation objetos3D
« on: January 13, 2012, 07:58:59 pm »
Hello everyone,

I'm having a little problem in storing 3D objects in a database for subsequent loading of objects in the same places left by the user. How do I load the rotation of objects stored in the database objects in the scene? For the translation I'm using .getTranslation (), but I do not know how to make the rotation.


P. S. I am brazilian, sorry for bad english

Thx in advance.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12047
    • View Profile
Re: Store and load rotation objetos3D
« Reply #1 on: January 13, 2012, 08:01:37 pm »
What's wrong with getRotationMatrix()? You can get an array-dump from a Matrix, which might be suitable to be stored in a DB more than the Matrix itself.

Offline Marlon

  • int
  • **
  • Posts: 74
    • View Profile
    • Forgotten Elements Action MMORPG
Re: Store and load rotation objetos3D
« Reply #2 on: January 18, 2012, 10:08:29 pm »
Rotation of an object:
Code: [Select]
object3D.rotateY(getModel().getDegree()/360f * PI);

Rotate to another object:
Code: [Select]
SimpleVector curPos = object3D.getTranslation();
SimpleVector targetDir = targetObject.calcSub(curPos);
float scale = object3D.getScale();