BGE: Some various changes to make moving the character physics type easier:

* Undoing the previous applyMovement() changes for characters. This was causing bugs for the Motion Actuator.
  * Creating a Character Motion type for the Motion Actuator with specific controls for characters. This includes moving, rotating and jumping.
  * Adding a KX_CharacterWrapper.walkDirection to set the character's direction and speed.

Note, this also resolves the following bugs:
[#33585] "Setting dLoc of motion actuator [0,0,0] via python won't stop object" reported by Manuel Bellersen (urfoex)
[#33503] "Character physics type won´t accept more than one motion anymore" reported by Mr Larodos
This commit is contained in:
Mitchell Stokes
2013-01-30 05:55:17 +00:00
parent 26ee2a1f79
commit 9191b783bb
16 changed files with 222 additions and 17 deletions

View File

@@ -75,6 +75,11 @@ void KX_BulletPhysicsController::SetLinVelocityMin(float val)
CcdPhysicsController::SetLinVelocityMin(val);
}
void KX_BulletPhysicsController::Jump()
{
CcdPhysicsController::Jump();
}
float KX_BulletPhysicsController::GetLinVelocityMax()
{
return (float)CcdPhysicsController::GetLinVelocityMax();
@@ -119,6 +124,11 @@ void KX_BulletPhysicsController::RelativeTranslate(const MT_Vector3& dloc,bool l
}
void KX_BulletPhysicsController::SetWalkDirection(const MT_Vector3& dloc,bool local)
{
CcdPhysicsController::SetWalkDirection(dloc[0],dloc[1],dloc[2],local);
}
void KX_BulletPhysicsController::RelativeRotate(const MT_Matrix3x3& drot,bool local)
{
float rotval[9];
@@ -155,6 +165,13 @@ MT_Vector3 KX_BulletPhysicsController::GetVelocity(const MT_Point3& pos)
return MT_Vector3(linVel[0],linVel[1],linVel[2]);
}
MT_Vector3 KX_BulletPhysicsController::GetWalkDirection()
{
float dir[3];
CcdPhysicsController::GetWalkDirection(dir[0], dir[1], dir[2]);
return MT_Vector3(dir[0], dir[1], dir[2]);
}
void KX_BulletPhysicsController::SetAngularVelocity(const MT_Vector3& ang_vel,bool local)
{
CcdPhysicsController::SetAngularVelocity(ang_vel.x(),ang_vel.y(),ang_vel.z(),local);