Jump... Roll... Ladder

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
JPulham
Posts: 320
Joined: Sat Nov 19, 2005 12:06 pm

Jump... Roll... Ladder

Post by JPulham »

three questions todo with a FPS camera and animator. How do I...

Jump?:
Probably been asked, but it needs collision detection ect

Crouch?:
Is there a way to resize the collision sphere in an animator?(like the last one... probably been done :roll: )

Climb A ladder?:
My idea was to have a cylinder around the ladder that turns off gravity when your inside it... any ideas?
pushpork
Kidinnu
Posts: 10
Joined: Fri Jun 02, 2006 6:54 pm
Location: North Carolina, USA

Re: Jump... Roll... Ladder

Post by Kidinnu »

JPulham wrote:three questions todo with a FPS camera and animator. How do I...

Jump?:
Probably been asked, but it needs collision detection ect
I'd look at irr::scene::CSceneNodeAnimatorFollowSpline. You could either set up a spline for the path you want the camera to follow, or just use it as an example. Doing something really full-featured that interacts "properly" with gravity probably requires building some physics.
Crouch?:
Is there a way to resize the collision sphere in an animator?(like the last one... probably been done :roll: )
According to the API, irr::scene::ISceneNodeAnimatorCollisionResponse has the method setEllipsoidRadius().
Climb A ladder?:
My idea was to have a cylinder around the ladder that turns off gravity when your inside it... any ideas?
My approach to this would be to have the camera animator remap what forward and backward do when you're close to a ladder, but I've never tried it.
JPulham
Posts: 320
Joined: Sat Nov 19, 2005 12:06 pm

Post by JPulham »

Jump... I'll look into it...

Crouch:

Code: Select all

OnKeyForCrouchDown()
{
    Animator->setEllipsoidRadius(vector3<16,32,16>);
}
OnKeyForCrouchUp()
{
    Animator->setEllipsoidRadius(vector3<16,64,16>);
}
Ladder (ish):

Code: Select all

if(collision)
{
    Animator->setGravity(vector3<0,0,0>);
}
if(!collision & Animator->getGravity() == vector3<0,0,0> )
{
    Animator->setGravity(vector3<0,-4,0>);
}
this could also be used for Halo Style Jets if the set gravity becomes vector3<0,1,0> (very weak compared to normal gravity).

I'll get back to you with some code maybe (code snippets forum)...
pushpork
Post Reply