How to get Forward vector from camera?

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.
Post Reply
ErUs
Posts: 165
Joined: Thu Oct 07, 2004 6:13 pm

How to get Forward vector from camera?

Post by ErUs »

Whats the correct way todo this?
Do i have to make a vector3df from getVewMatrix[0], [1] and [2] because that seems a bit overkill....
ErUs
Posts: 165
Joined: Thu Oct 07, 2004 6:13 pm

Post by ErUs »

Found it

Code: Select all

vector3df forward = cam->getRotation().rotationToDirection();
sudi
Posts: 1686
Joined: Fri Aug 26, 2005 8:38 pm

Post by sudi »

but only works when you bind target and rotation i believe.

a save way would be:

Code: Select all

irr::core::vector3df forward = cam->getTarget()-cam->getAbsolutePosition();
forward.normalize();
We're programmers. Programmers are, in their hearts, architects, and the first thing they want to do when they get to a site is to bulldoze the place flat and build something grand. We're not excited by renovation:tinkering,improving,planting flower beds.
Post Reply