3rd and 1st Person Cameras

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
abecks
Posts: 19
Joined: Fri Jul 21, 2006 2:38 am
Location: British Columbia, Canada
Contact:

3rd and 1st Person Cameras

Post by abecks »

I remember in Jedi Knight (built from the Quake 2 engine) that you could change your camera angle to 3rd person by pressing F1.

In 3rd person view, your camera looked wherever the character looks. You can see your characters model and the weapon he is using is attached approporiately.

However!

In 1st person view. you do not see your character model. My question is, in 1st person view, is the gun you are seeing the gun that is attached to your character's model, or is it a different model only displayed in 1st person camera?

I seem to recall 3rd and 1st person weapon models being different from modding the game.

Any ideas?



Also, with 3rd person cameras, it looks like the camera looks through your characters head. How to describes this... when you aim your cursor, the camera is always facing where your aiming, but always THROUGH your characters head. Anyone able to easily accomplish this?
JPulham
Posts: 320
Joined: Sat Nov 19, 2005 12:06 pm

Post by JPulham »

the last one:

Code: Select all

Set cam target to head centre;
find crosshair target;
normalize crosshair target;
negative crosshair target; //'-crosshair target' or 'crosshair target - (crosshair target * 2)'
multiply by dist from head;
this is cam position;
hope this pusedo code makes sense. If not post back and tell me.
pushpork
abecks
Posts: 19
Joined: Fri Jul 21, 2006 2:38 am
Location: British Columbia, Canada
Contact:

Post by abecks »

Little to advanced for me, not that familiar with Irrlicht's camera manipulation yet.
Dances
Posts: 454
Joined: Sat Jul 02, 2005 1:45 am
Location: Canada
Contact:

Post by Dances »

My code for positioning a 3rd person camera is as follows.
cpos = camera position
pos = avatar position
rot = avatar rotation
crot = camera rotation
R_PI = 0.0174532925
cameraradius = camera's distance from player.

cpos.X = pos.X + cos(rot.Y*R_PI) * -cameraradius;
cpos.Y = pos.Y - sin(crot.X*R_PI) * cameraradius;
cpos.Z = pos.Z + sin(rot.Y*R_PI) * cameraradius;

And then you set up a mouselook that changes the angle of the player model on the Y and the angel of the camera on the X axis.

As for a transparent head, I'd just make the head a separate model and change its alpha value when needed.

And yes, the 1st and 3rd person models are different. There is no character model in 1st person and the weapon is also usually more detailed in 1st.
Spanky
Posts: 5
Joined: Wed Jul 20, 2005 1:10 pm

Post by Spanky »

Dances wrote:My code for positioning a 3rd person camera is as follows.
cpos = camera position
pos = avatar position
rot = avatar rotation
crot = camera rotation
R_PI = 0.0174532925
cameraradius = camera's distance from player.

cpos.X = pos.X + cos(rot.Y*R_PI) * -cameraradius;
cpos.Y = pos.Y - sin(crot.X*R_PI) * cameraradius;
cpos.Z = pos.Z + sin(rot.Y*R_PI) * cameraradius;

And then you set up a mouselook that changes the angle of the player model on the Y and the angel of the camera on the X axis.

As for a transparent head, I'd just make the head a separate model and change its alpha value when needed.

And yes, the 1st and 3rd person models are different. There is no character model in 1st person and the weapon is also usually more detailed in 1st.
Thanks for that!

I've been trying to figure it out for a while..... :roll:
Of all the things i've lost, i miss my mind the most...
joshua1091
Posts: 23
Joined: Thu Aug 09, 2007 5:16 pm

help....doubt...

Post by joshua1091 »

does that mean that i dont need a player model when im usig first person view....
and please bear with me....

how do i get a call of duty or quake or serious sam like look in my game using irrlicht cameras...where i actually cannot see the player but can see the weapon in his hand(as if the player in game is actually me...and everything i see is from my actual view point.)
is that accomplished by merging the FPS camera and just a weapon model or will i have to design a whole player model and place camera at some point inside the model appropriately.
and please give me a code as how to merge the model and camera...(that is ...to get the effect i mentioned above,where the camera moves along with the model or the other way....the model moves wherever the camera moves)

[TO PUT IN SIMPLE WORDS...I WOULD LIKE TO SEE A GUN TIP IN MY FPS CAMERA...MOVING ALONG WITH THE CAMERA]
Acki
Posts: 3496
Joined: Tue Jun 29, 2004 12:04 am
Location: Nobody's Place (Venlo NL)
Contact:

Post by Acki »

a simple rule for performance: don't model anything you can't see !!! ;)
so in 1st person you don't need a complete character, just what you see, weapon and maybe hands...
while(!asleep) sheep++;
IrrExtensions:Image
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
Post Reply