Switching from fps View to 3rd person view

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
Daystar
Posts: 58
Joined: Tue Jul 17, 2007 3:53 pm
Contact:

Switching from fps View to 3rd person view

Post by Daystar »

In my game one of the key features is switching from FPS mode to 3rd Person mode with a click of a key. I'm trying to add that feature to my code now but I am totally lost. As a test I'm using the ninja model from another post. I know that you would add a camera using

Code: Select all

ICameraSceneNode* camera = SceneManager->addCameraSceneNode();
But from there I can't figure out:
1) where to put the camera for the FPS mode on the ninja model
2) How to set up a 3rd person cam
3) How to switch from one to the other
4)Switch controls for the separate modes

Can anyone give me a hand here please?
DayStar
Acki
Posts: 3496
Joined: Tue Jun 29, 2004 12:04 am
Location: Nobody's Place (Venlo NL)
Contact:

Re: Switching from fps View to 3rd person view

Post by Acki »

Daystar wrote:1) where to put the camera for the FPS mode on the ninja model
at it's head's position and set node's visibility to false...
Daystar wrote:2) How to set up a 3rd person cam
behind and above the head's position and set node's visibility to true...
Daystar wrote:3) How to switch from one to the other
react on the key stroke and perform 1) or 2)...
Daystar wrote:4)Switch controls for the separate modes
set the keys depending on the state you're in (1 or 2)...

maybe a better solution is to create 2 cameras (one for state 1 and another for state 2) with different key maps and switch between the cameras depending on the curren state (1 or 2)...
Last edited by Acki on Wed Oct 29, 2008 9:12 pm, edited 1 time in total.
while(!asleep) sheep++;
IrrExtensions:Image
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
jddevnet
Posts: 17
Joined: Mon Oct 06, 2008 8:27 pm

Post by jddevnet »

I think the splitview tutorial will help you out. It demonstrates switching between cameras and using a few types of them.

http://irrlicht.sourceforge.net/tut017.html

This would provide a first person camera:

Code: Select all

ICameraSceneNode* camera2 = smgr->addCameraSceneNodeFPS();
Also check out the Maya camera:

Code: Select all

ICameraSceneNode* camera3 = smgr->addCameraSceneNodeMaya();
Daystar
Posts: 58
Joined: Tue Jul 17, 2007 3:53 pm
Contact:

Post by Daystar »

Would I set the camera as a parent to the models scene node?
DayStar
Acki
Posts: 3496
Joined: Tue Jun 29, 2004 12:04 am
Location: Nobody's Place (Venlo NL)
Contact:

Post by Acki »

Daystar wrote:Would I set the camera as a parent to the models scene node?
not neccassarily, it depends on how you want to do the moving... ;)
if you want to use the camera's build in moving than I would do so...
while(!asleep) sheep++;
IrrExtensions:Image
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
Daystar
Posts: 58
Joined: Tue Jul 17, 2007 3:53 pm
Contact:

Post by Daystar »

How will I edit the models position by using the event receiver using w to go forward instead of the using the built in function.
DayStar
Acki
Posts: 3496
Joined: Tue Jun 29, 2004 12:04 am
Location: Nobody's Place (Venlo NL)
Contact:

Post by Acki »

there are some threads about this, just search the forum... ;)

but if you use the camera as parent then why not using its movement, you can specify the keys for moving when creating the camera (look at the api for addCameraSceneNodeFPS, there is a demonstration for setting the key map for the camera)...
while(!asleep) sheep++;
IrrExtensions:Image
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
Post Reply