FPS camera without using FPScamera...

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
Zoulz
Posts: 12
Joined: Fri Aug 19, 2005 11:07 am
Location: Sweden
Contact:

FPS camera without using FPScamera...

Post by Zoulz »

I'd like to know how to re-create the FPS camera without using the existing fpscamera supplied with irrlicht. The reason for this is because I want to be able to control the event reciever on my own.

How does the rotation part work? setting the direction of the camera only takes a vector.. how would I go about creating a direction vector from a X & Y degree?
WToma
Posts: 70
Joined: Tue Aug 09, 2005 8:38 am
Location: Szeged, Hungary

Post by WToma »

The simplest way, I think, is to copy the code of FPS camera and just change the event receiver part.
If you want to create a direction vector, you can do as the following:
let alpha be the angle around y axis and let beta be the angle around x axis. We use degrees as unit, because most irrlicht functions use degrees, too. Then you can create your direction vector:

Code: Select all

//first, we convert the angles into radians
float alpha_rad=(alpha/180.0f)*M_PI;
float beta_rad=(beta/180.0f)*M_PI;
direction_vector=core::vector3df(cos(alpha_rad), sin(beta_rad), sin(alpha_rad));
Toma
"This is not a bug, this is a feature!"
Acki
Posts: 3496
Joined: Tue Jun 29, 2004 12:04 am
Location: Nobody's Place (Venlo NL)
Contact:

Post by Acki »

Have a look at my 2nd post in this thread:

http://irrlicht.sourceforge.net/phpBB2/ ... 0ec26bc26e

Maybe this could help you...
while(!asleep) sheep++;
IrrExtensions:Image
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
Nick_Japan
Posts: 98
Joined: Mon Dec 13, 2004 11:47 am
Location: Japan

Post by Nick_Japan »

If you want the built-in FPS camera and also to control the event receiver, rig up your own receiver as described in the tutorials, but return false instead of true if it's a camera event. This tells Irrlicht that you haven't dealt with the event yourself and so it will be passed to the default event receiver and therefore picked up by your FPS camera.
Post Reply