How to make jumping by PlayerController?

parkshevchun

20-07-2010 17:25:37

My sourcecode ,
------------------------------------------------------------------------------------------------------------------------------
- framestart()

mAppCharacter->mPlayer->getVelocity(mAppCharacter->forwardSpeed, mAppCharacter->sideSpeed, mAppCharacter->heading);

mAppCharacter->forwardSpeed = 0.0f;
mAppCharacter->sideSpeed = 0.0f;

if(UpKey)
mAppCharacter->forwardSpeed += 5.0f;
if(DownKey)
mAppCharacter->forwardSpeed -= 5.0f;

if(LeftKey)
{
mAppCharacter->heading += Degree(45.0f) / 920.0f;
}
if(RightKey)
{
mAppCharacter->heading -= Degree(45.0f) / 920.0f;
}

mAppCharacter->mPlayer->setVelocity(mAppCharacter->forwardSpeed, mAppCharacter->sideSpeed, mAppCharacter->heading);
------------------------------------------------------------------------------------------------------------------------------

I pressed the space-bar when the character will jump.

How to make jumping by PlayerController?

help me ~ :(

koirat

20-07-2010 18:37:30

For a simple jump you can do an Impulse on a body.

parkshevchun

21-07-2010 14:36:58

This my Impuse code,

if(jump)
{
mBody->addImpulse(mNode->getOrientation()*Vector3(0, 5, 0), mNode()->getPosition());
}

This is too fast speed jumping.

please Show me the simple code?

kallaspriit

22-07-2010 10:32:18

Just use a lower number instead of the 5?

Beauty

09-08-2010 14:16:21

If the question is: How to read a button status of a gamepad?
Then you could use the OIS library:
http://www.ogre3d.org/tikiwiki/OIS