Jumping with the FPS camera?

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
Jyrenth
Posts: 8
Joined: Sat Dec 06, 2003 9:27 pm

Jumping with the FPS camera?

Post by Jyrenth »

I've just been playing around with Irrlicht, and the only way I can jump with the FPS camera is to look up and walk forward (Which I'd rather not be able to do).

How would one go about making is so when you hit... the left control button, it'll boost up the FPS camera for a jump?

Sample code would be appreciated, on account of I'm a newbie :)
Jyrenth
Posts: 8
Joined: Sat Dec 06, 2003 9:27 pm

Post by Jyrenth »

Bump
keless
Posts: 805
Joined: Mon Dec 15, 2003 10:37 pm
Location: Los Angeles, California, USA

Post by keless »

then the user presses the 'jump' key, set a boolean 'isJumping' to true.

every update, check this boolean. If its true, then increase your camera's position in the Y direction. Of course, you'll only want them to be able to jump, not fly, so you might limit how long they can do this, or only let them jump from a 'standing' position.

Its not very easy to modify the IrrLicht FPS camera to do this-- Instead, I suggest you create your own camera class to handle it. You can look for topics in the HowTo section that discuss custom cameras.
a screen cap is worth 0x100000 DWORDS
Guest
Posts: 35
Joined: Mon Feb 02, 2004 7:17 pm
Location: Russia, Saint-Petersburg

Post by Guest »

In fact, I'm conviced it will be better to attach a new animator (like CSceneNodeAnimatorJump) to the camera (or any other object) since the camera implements ISceneNode interface.

E.g. when I needed "rocking" of some of my objects I created such animator. Actually it was just a "bi-directional rotator". But still it's a good architecture, and the power is that you don't have to create your own camera (with your own bugs :) but you can just attach animator insead. Every moving shoud be performed with a corresponding animator.

Actually, the best way is to implement an animator based on timer events.
Also look at this http://irrlicht.sourceforge.net/phpBB2/ ... php?p=6577. It can help, cause jumpin can be calculated with the real physics engine.

Am I right? :)
Post Reply