From 5675155be44b0243fa8c6e53605d0b069464f79c Mon Sep 17 00:00:00 2001 From: Robin Engman Date: Wed, 26 Feb 2014 10:05:18 +0100 Subject: [PATCH] Fixed player jump --- Code/Game/GameLogic/Player.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Code/Game/GameLogic/Player.cpp b/Code/Game/GameLogic/Player.cpp index ebc38d26..9625822e 100644 --- a/Code/Game/GameLogic/Player.cpp +++ b/Code/Game/GameLogic/Player.cpp @@ -70,7 +70,7 @@ void Player::BeginFrame() Oyster::Math::Float maxSpeed = 30; // Rotate player accordingly - this->rigidBody->AddRotationAroundY(this->rotationUp); + this->rigidBody->AddRotationAroundY(this->rotationUp); this->rigidBody->SetUp(this->rigidBody->GetState().centerPos.GetNormalized()); // Direction data @@ -119,7 +119,7 @@ void Player::BeginFrame() } // Dampen velocity if certain keys are not pressed - if(key_jump <= 0.001 && IsWalking()) + if(key_jump <= 0.001 && IsWalking()) { if(key_forward <= 0.001 && key_backward <= 0.001) { @@ -146,7 +146,7 @@ void Player::BeginFrame() walkDirection.Normalize(); // If on the ground, accelerate normally - if(IsWalking()) + if(IsWalking()) { if(forwardSpeed < maxSpeed) { @@ -158,7 +158,7 @@ void Player::BeginFrame() } } // If in the air, accelerate slower - if(IsJumping()) + if(IsJumping()) { if(forwardSpeed < maxSpeed) { @@ -294,11 +294,11 @@ bool Player::IsWalking() } bool Player::IsJumping() { - return (this->rigidBody->GetLambda() < 1.0f); + return (this->rigidBody->GetLambda() == 1.0f); } bool Player::IsIdle() { - return (this->rigidBody->GetLambda() < 1.0f && this->rigidBody->GetLinearVelocity().GetMagnitude() < 0.0001f); + return (this->rigidBody->GetLambda() == 1.0f && this->rigidBody->GetLinearVelocity().GetMagnitude() < 0.0001f); } void Player::Inactivate()