Moderators: Sascha Willems, walaber
rystills wrote:how might I go about allowing the player to influence the PlayerController's mid-air movement? SetForwardSpeed and SetLateralSpeed are perfect on the ground, but once the Player leaves the ground by jumping or falling, the player loses all control until the PlayerController lands on the ground once more. I would like to provide the Player with some control over the PlayerController while in midair in order to make jumping more precise.
virtual void ApplyMove (dCustomPlayerController* const controller, dFloat timestep)
{
// calculate the gravity contribution to the velocity
dVector gravity(controller->GetFrame().RotateVector(dVector(DEMO_GRAVITY, 0.0f, 0.0f, 0.0f)));
dVector totalImpulse(controller->GetImpulse() + gravity.Scale (controller->GetMass() * timestep));
if (PlayerAirbone()) {
//totalImpulse + someUserImpulse
}
controller->SetImpulse(totalImpulse);
.....
rystills wrote:It seems like SetForwardSpeed and SetLateralSpeed don't work while the Player is in the air, so whatever speed the player had when he jumped is locked until he reaches the ground.
Users browsing this forum: No registered users and 16 guests