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:
@@ -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 {
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user