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
This commit is contained in:
Thomas Szepe 2015-05-14 09:45:51 +02:00
parent 687f6a9752
commit 8bf9e1412f
Notes: blender-bot 2023-02-14 11:29:52 +01:00
Referenced by issue #44705, Pressing escape while modifying multiple object gives weird results
Referenced by issue #44706, multiple object editing bug if alt is pressed after first edits
2 changed files with 10 additions and 4 deletions

View File

@ -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 {

View File

@ -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,