Getting the forward vector of a FPS 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
sunnystormy
Posts: 105
Joined: Mon Jun 02, 2014 2:32 am
Location: Washington, D.C.
Contact:

Getting the forward vector of a FPS camera?

Post by sunnystormy »

Howdy, all!

I've got an audio engine I've built from scratch that I'm pairing with Irrlicht, but I need to get the forward vector of the camera in order to properly set the Listener Orientation. Does Irrlicht provide a convenience method for that?

Please let me know!
My blog: http://fsgdp.wordpress.com "The Free Software Game Development Pipeline"
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Getting the forward vector of a FPS camera?

Post by CuteAlien »

Forward is:
camera->getTarget() - camera->getAbsolutePosition ();
You might need to normalize depending on use. Also getPosition instead of getAbsolutePosition is good enough if you don't have parents for your camera.

If you also need up-vector, it's just camera->getUpVector()
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Post Reply