Storing camera position

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
SuB
Posts: 16
Joined: Fri Aug 27, 2004 9:27 pm

Storing camera position

Post by SuB »

I'm working on a project where I have 2 camera's, one is a static and the other one is the fps camera.

I managed to be able to switch bewteen the cameras but everytime I go back to the fps camera it returns to it's starting position.

I've been messing around with the get and set position() but I keep losing the camera's new position.

How do you do this? Where should I initialise my camera's? Is there a way to store the camera position and reaply it later?
Gav
Posts: 23
Joined: Fri Jul 16, 2004 12:28 pm

Post by Gav »

couldnt you use the current position of the player character to set the new position of the FPS camera :?:
im not sure but it sounds right ?
SuB
Posts: 16
Joined: Fri Aug 27, 2004 9:27 pm

Post by SuB »

yeah I could, but right now, the player is just a camera floating around, you're suggesting I attach a node to the fps camera so I could just redirect the camera to the player-node's position?

It is a good workaround, i've been trying to find how the the addCameraSceneNodeFPS is build in the source because in it's construct they don't give it a position, they just add cameraspeed and such.

if you could give it a start position I could make that one variable and everytime the camera gets loaded I could make the start position my previous position :), but I'll try your way first, if it works, I can move on :d
SuB
Posts: 16
Joined: Fri Aug 27, 2004 9:27 pm

Post by SuB »

damm, can't figure it out

driving me crazy :cry:
etcaptor
Posts: 871
Joined: Fri Apr 09, 2004 10:32 pm
Location: Valhalla
Contact:

Post by etcaptor »

Use for static camera
AddCameraSceneNode instead addCameraSceneNodeMaya .
Gav
Posts: 23
Joined: Fri Jul 16, 2004 12:28 pm

Post by Gav »

SuB wrote:yeah I could, but right now, the player is just a camera floating around, you're suggesting I attach a node to the fps camera so I could just redirect the camera to the player-node's position?

It is a good workaround, i've been trying to find how the the addCameraSceneNodeFPS is build in the source because in it's construct they don't give it a position, they just add cameraspeed and such.

if you could give it a start position I could make that one variable and everytime the camera gets loaded I could make the start position my previous position :), but I'll try your way first, if it works, I can move on :d
:oops: :lol: err yeh thats what i meant :shock: hehehe i think you have a better idea of it than I do
mm765
Posts: 172
Joined: Fri May 28, 2004 10:12 am

Post by mm765 »

i probably misunderstood what you want to do but why not just use camera->getPosition() and camera->setPosition() ?
maybe you should save/set the camera's target, too but ...
SuB
Posts: 16
Joined: Fri Aug 27, 2004 9:27 pm

Post by SuB »

How can you make the program wait for an input?

What I want to do is stay in the static camera until a button is clicked, then the fps camera can be used again
bal
Posts: 829
Joined: Fri Jun 18, 2004 5:19 pm
Location: Geluwe, Belgium

Post by bal »

Use the event receiver...
General Tools List
General FAQ
System: AMD Barton 2600+, 512MB, 9600XT 256MB, WinXP + FC3
Oz
Posts: 81
Joined: Tue Aug 31, 2004 3:34 pm

Post by Oz »

http://irrlicht.sourceforge.net/phpBB2/ ... php?t=3651

This is a similar topic and I posted some of my code on the setPosition(getPosition) thing. Its not perfect but may help.
(camera switching I mean)
"When we looked at the relics of the precursors, we saw what heights civilization can attain.
When we looked at their ruins, we marked the danger of that height." -Keeper Annals
(Thief2: The Metal Age)
SuB
Posts: 16
Joined: Fri Aug 27, 2004 9:27 pm

Post by SuB »

Tnx everyobody, and allot of tnx go to Oz :D

seemed that the only thing I was missing was setActiveCamera and a little reorganising

I can roam around the level in the fps camera, when I hit a button the camera freezes and I have cursor control in my menus, I hit the button again and the menu's go away and I can continue roaming :D :D :D

SuB is very happy, tnx guys
Oz
Posts: 81
Joined: Tue Aug 31, 2004 3:34 pm

kudos

Post by Oz »

Great! Im glad it was a help. The reason I did all that was just so I could toggle wireframe rendering, im coding another quadtree 8)
Im a sucker for punishment, you could say :?
"When we looked at the relics of the precursors, we saw what heights civilization can attain.
When we looked at their ruins, we marked the danger of that height." -Keeper Annals
(Thief2: The Metal Age)
Post Reply