Store and load rotation objetos3D

Started by MegasXLS, January 13, 2012, 07:58:59 PM

Previous topic - Next topic

MegasXLS

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.

o//

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

Thx in advance.

EgonOlsen

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.

Marlon

Rotation of an object:
object3D.rotateY(getModel().getDegree()/360f * PI);


Rotate to another object:

SimpleVector curPos = object3D.getTranslation();
SimpleVector targetDir = targetObject.calcSub(curPos);
float scale = object3D.getScale();
object3D.setScale(1f);
object3D.setRotationMatrix(newDir.getRotationMatrix());
object3D.setScale(scale);
www.forgottenelements.com
Free Action JAVA MMORPG