Newbie Help with addSceneCameraNodeFPS.

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
skel1
Posts: 24
Joined: Sun Oct 26, 2003 2:19 am
Location: USA
Contact:

Newbie Help with addSceneCameraNodeFPS.

Post by skel1 »

The FPS camera doesn't want to move for me... I can make it look around with the mouse, but the arrow keys won't move it. I didn't realize this was wrong until after i started taking the collisions and it mentioned being able to move in tutorial 2.

I've compared my code with the example and swapped lines a little bit, but it looks (to me) to be the same and I'm not sure what i'm doing wrong. I named the camera node "camera" and i highlight the word camera as yellow in my source code so hopefully it will be easier for someone to tell me what i'm doing. Thanks so much.

http://patrickavella.com/help.html
[dx/x]=HUNT3R
Posts: 271
Joined: Sat Aug 23, 2003 5:52 pm
Location: Hurricane Central, Florida

Post by [dx/x]=HUNT3R »

You've got an error on line 26

Code: Select all

if (pc!=0 && event.EventType == EET_KEY_INPUT_EVENT&&
                event.KeyInput.PressedDown) {
You put the && right next to the end of EVENT. Also, it should be !event.KeyInput.PressedDown, but I don't understand why you're trying to create a flyCircleAnimator with the FPSCamera? And why are you returning the camera twice?
skel1
Posts: 24
Joined: Sun Oct 26, 2003 2:19 am
Location: USA
Contact:

Post by skel1 »

the second camera return is commented out left over from another tutorial, and the variable "rotate" is getting reused (it's named "anim" in the tutorial), i drop it and reset it after I init each node.

I fixed the error in my code, but i still can't move the camera with my arrow keys.. hmmmm

The tutorial compiles and works fine, but i've gone and messed something up :) I'm sure it will end up being something simple but i'm just not seeing it :(
[dx/x]=HUNT3R
Posts: 271
Joined: Sat Aug 23, 2003 5:52 pm
Location: Hurricane Central, Florida

Post by [dx/x]=HUNT3R »

Maybe you don't need that ! after all... I've been looking to change the keys to WSAD also but I haven't got around to it yet so I'm not exactly sure how to tell you to do it. But you say the arrow keys won't work? All you need for an event receiver class that uses the arrows is this:

Code: Select all

class MyEventReceiver : public IEventReceiver
{
public:
	virtual bool OnEvent(SEvent event)
	{
		if (camera)
			return camera->OnEvent(event);

		return false;
	}
};
That'll move you around with the arrow keys...
skel1
Posts: 24
Joined: Sun Oct 26, 2003 2:19 am
Location: USA
Contact:

Post by skel1 »

I just used your code (copy+paste) and replaced my old event reciever...... still no change. The arrow keys will not move me.
[dx/x]=HUNT3R
Posts: 271
Joined: Sat Aug 23, 2003 5:52 pm
Location: Hurricane Central, Florida

Post by [dx/x]=HUNT3R »

get rid of the

Code: Select all

camera->addAnimator(rotate);
and see if it works then...
skel1
Posts: 24
Joined: Sun Oct 26, 2003 2:19 am
Location: USA
Contact:

Post by skel1 »

yay it works!

thank you :!:
Post Reply