diff options
author | Thomas Szepe <HG1_public@gmx.net> | 2015-05-14 10:45:51 +0300 |
---|---|---|
committer | Thomas Szepe <HG1_public@gmx.net> | 2015-05-14 10:45:51 +0300 |
commit | 8bf9e1412fac3312cfdf22869312caf32f99c4c2 (patch) | |
tree | 6b0981f4d729beaf978cc7722f4c31d10519821c /source/gameengine/Ketsji | |
parent | 687f6a9752fd2009f67dd0b66208777cd203bde1 (diff) |
BGE: Fix: Double jumps are not working with character motion actuator
The actual character motion actuator triggers every frame the jump method.
Adding an edge detection to trigger the jump method.
Reviewers: lordloki, sybren, moguri
Reviewed By: moguri
Differential Revision: https://developer.blender.org/D1220
Diffstat (limited to 'source/gameengine/Ketsji')
-rw-r--r-- | source/gameengine/Ketsji/KX_ObjectActuator.cpp | 11 | ||||
-rw-r--r-- | source/gameengine/Ketsji/KX_ObjectActuator.h | 3 |
2 files changed, 10 insertions, 4 deletions
diff --git a/source/gameengine/Ketsji/KX_ObjectActuator.cpp b/source/gameengine/Ketsji/KX_ObjectActuator.cpp index f65b0ac0f4f..c987ebbdd85 100644 --- a/source/gameengine/Ketsji/KX_ObjectActuator.cpp +++ b/source/gameengine/Ketsji/KX_ObjectActuator.cpp @@ -140,6 +140,7 @@ bool KX_ObjectActuator::Update() m_angular_damping_active = false; m_error_accumulator.setValue(0.0,0.0,0.0); m_previous_error.setValue(0.0,0.0,0.0); + m_jumping = false; return false; } else if (parent) @@ -247,10 +248,14 @@ bool KX_ObjectActuator::Update() { parent->ApplyRotation(m_drot,(m_bitLocalFlag.DRot) != 0); } - if (m_bitLocalFlag.CharacterJump) - { - character->Jump(); + if (m_bitLocalFlag.CharacterJump) { + if (!m_jumping) { + character->Jump(); + m_jumping = true; + } + else if (character->OnGround()) + m_jumping = false; } } else { diff --git a/source/gameengine/Ketsji/KX_ObjectActuator.h b/source/gameengine/Ketsji/KX_ObjectActuator.h index 1f2453e3700..b5622d97611 100644 --- a/source/gameengine/Ketsji/KX_ObjectActuator.h +++ b/source/gameengine/Ketsji/KX_ObjectActuator.h @@ -116,7 +116,8 @@ class KX_ObjectActuator : public SCA_IActuator bool m_active_combined_velocity; bool m_linear_damping_active; bool m_angular_damping_active; - + bool m_jumping; + public: enum KX_OBJECT_ACT_VEC_TYPE { KX_OBJECT_ACT_NODEF = 0, |