[Bf-blender-cvs] [8bf9e14] master: BGE: Fix: Double jumps are not working with character motion actuator

Thomas Szepe noreply at git.blender.org
Thu May 14 09:46:11 CEST 2015


Commit: 8bf9e1412fac3312cfdf22869312caf32f99c4c2
Author: Thomas Szepe
Date:   Thu May 14 09:45:51 2015 +0200
Branches: master
https://developer.blender.org/rB8bf9e1412fac3312cfdf22869312caf32f99c4c2

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

===================================================================

M	source/gameengine/Ketsji/KX_ObjectActuator.cpp
M	source/gameengine/Ketsji/KX_ObjectActuator.h

===================================================================

diff --git a/source/gameengine/Ketsji/KX_ObjectActuator.cpp b/source/gameengine/Ketsji/KX_ObjectActuator.cpp
index f65b0ac..c987ebb 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 1f2453e..b5622d9 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,




More information about the Bf-blender-cvs mailing list