If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
rakkar
Posts: 19 Joined: Sun Aug 07, 2005 11:24 pm
Post
by rakkar » Thu Apr 23, 2009 6:00 pm
If I want to rotate a model interpThisTickRotation degrees around the Y axis, is this the right way to do it?
Code: Select all
core::matrix4 modelTransformation = model->getRelativeTransformation();
core::matrix4 rotationMat;
rotationMat.setRotationDegrees(core::vector3df(0,interpThisTickRotation,0));
modelTransformation*=rotationMat;
model->setRotation(modelTransformation.getRotationDegrees());
B@z
Posts: 876 Joined: Thu Jan 31, 2008 5:05 pm
Location: Hungary
Post
by B@z » Thu Apr 23, 2009 11:52 pm
i dont understand, why you just dont use setRotation?
model->setRotation(vector3df(0,interpThisTickRotation,0));
is it too easy? xD
rakkar
Posts: 19 Joined: Sun Aug 07, 2005 11:24 pm
Post
by rakkar » Fri Apr 24, 2009 1:40 am
That sets the absolute rotation. I want to rotate by a certain amount.
rakkar
Posts: 19 Joined: Sun Aug 07, 2005 11:24 pm
Post
by rakkar » Fri Apr 24, 2009 2:07 am
Here it is:
Code: Select all
model->setRotation(model->getRotation()+core::vector3df(0,interpThisTickRotation,0));
I'm used to other engines where you have to do the low-level math on everything.
vipergc
Posts: 27 Joined: Mon Mar 02, 2009 3:33 am
Location: Louisville, KY
Contact:
Post
by vipergc » Fri Apr 24, 2009 3:57 pm
no.. setRotation() sets the rotation relative to the parent... not absolutely
Co-Inventor of ZIP files.
Hardware - play with it long enough.. it BREAKS
Software - play with it long enough.. it WORKS
hybrid
Admin
Posts: 14143 Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:
Post
by hybrid » Fri Apr 24, 2009 6:02 pm
I think this is a mis-understanding. By absolute, rakkar meant not-incrementing, which is just as correct as your statement. However, the method name setRotation does already hint for the fact that it's not accumulating, otherwise it would be "rotate" or "addRotation".