basically i have a node that rotates when you press left/right and then want it to go forward/back when i press up/down, however I can't figure out how to move it forward/back relative to its current rotation.
i have already searched thru the documentation and tried various ways but with no success... so remember this is the BEGINNERS forum and dont tell me I should be able to figure it out because I CAN'T!!!
moving "forward" according to current rotation
-
- Posts: 386
- Joined: Thu Sep 25, 2003 12:43 pm
- Contact:
Ouch, too much math.
Look here
http://irrlicht.sourceforge.net/phpBB2/ ... php?t=3705
or here
http://irrlicht.sourceforge.net/phpBB2/ ... php?t=3708
Hope it helps!
Look here
http://irrlicht.sourceforge.net/phpBB2/ ... php?t=3705
or here
http://irrlicht.sourceforge.net/phpBB2/ ... php?t=3708
Hope it helps!
"When we looked at the relics of the precursors, we saw what heights civilization can attain.
When we looked at their ruins, we marked the danger of that height." -Keeper Annals
(Thief2: The Metal Age)
When we looked at their ruins, we marked the danger of that height." -Keeper Annals
(Thief2: The Metal Age)
-
- Posts: 386
- Joined: Thu Sep 25, 2003 12:43 pm
- Contact:
LOL
No I mean use matrix math. Matrices are your friend!
Thanks for your code, im sure it works great.
No I mean use matrix math. Matrices are your friend!
Thanks for your code, im sure it works great.
"When we looked at the relics of the precursors, we saw what heights civilization can attain.
When we looked at their ruins, we marked the danger of that height." -Keeper Annals
(Thief2: The Metal Age)
When we looked at their ruins, we marked the danger of that height." -Keeper Annals
(Thief2: The Metal Age)
This is something I've been working on as 2 of my test projects needs some sort of GetOrientation() function.
I've been trying to read more on how to get a vector form of orientation, but everything out there gives a very simple quaternion method that doesn't involve vectors.
I could swear the answer is some form of Orientation =YawVector + PitchVector + RollVector;
I've been trying to read more on how to get a vector form of orientation, but everything out there gives a very simple quaternion method that doesn't involve vectors.
I could swear the answer is some form of Orientation =YawVector + PitchVector + RollVector;
Crud, how do I do this again?
here is function for moving in 3d space (works in 2d too):
http://irrlicht.sourceforge.net/phpBB2/ ... php?t=3608
http://irrlicht.sourceforge.net/phpBB2/ ... php?t=3608
Dang.. I searched the forums for 3 hours yesterday for that post. Read through a lot of code from a lot of people (you, Oz, jox, mm, etc...)
I made a demo just like your spaceship one in Ogre about 2 years ago using straight matrix math, but haven't used it since so the knowledge all leaked out.
jox gave me the same answer and I used yours to clean up the code.
Seems like this should be a function in irr::scene::ISceneNode... like setPositionRelativetoSelf() but I bet there is a better word already in the 3D dictionary.
I made a demo just like your spaceship one in Ogre about 2 years ago using straight matrix math, but haven't used it since so the knowledge all leaked out.
jox gave me the same answer and I used yours to clean up the code.
Code: Select all
irr::core::vector3df dir = irr::core::vector3df(0.0f,0.0f,OffSet); //Offset = Speed * Time Factor; for smooth animation
irr::core::matrix4 rotMatrix;
rotMatrix.setRotationDegrees(node->getRotation());
rotMatrix.transformVect(dir);
node->setPosition(node->getPosition() + dir);
Crud, how do I do this again?