forked from bartvdbraak/blender
BGE: Fix T36703: Character motion actuator local movement not working correct.
The character motion actuator local movement does not taking account of the object rotation. It is necessary to rotate the motion vector before adding the local movement. Reviewers: sybren, lordloki, moguri Reviewed By: lordloki, moguri Maniphest Tasks: T42709 Differential Revision: https://developer.blender.org/D1206
This commit is contained in:
parent
1a117ad40c
commit
29e968a315
@ -223,6 +223,11 @@ bool KX_ObjectActuator::Update()
|
|||||||
else if (m_bitLocalFlag.CharacterMotion) {
|
else if (m_bitLocalFlag.CharacterMotion) {
|
||||||
MT_Vector3 dir = m_dloc;
|
MT_Vector3 dir = m_dloc;
|
||||||
|
|
||||||
|
if (m_bitLocalFlag.DLoc) {
|
||||||
|
MT_Matrix3x3 basis = parent->GetPhysicsController()->GetOrientation();
|
||||||
|
dir = basis * dir;
|
||||||
|
}
|
||||||
|
|
||||||
if (m_bitLocalFlag.AddOrSetCharLoc) {
|
if (m_bitLocalFlag.AddOrSetCharLoc) {
|
||||||
MT_Vector3 old_dir = character->GetWalkDirection();
|
MT_Vector3 old_dir = character->GetWalkDirection();
|
||||||
|
|
||||||
@ -236,11 +241,6 @@ bool KX_ObjectActuator::Update()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// We always want to set the walk direction since a walk direction of (0, 0, 0) should stop the character
|
// We always want to set the walk direction since a walk direction of (0, 0, 0) should stop the character
|
||||||
if (m_bitLocalFlag.DLoc)
|
|
||||||
{
|
|
||||||
MT_Matrix3x3 basis = parent->GetPhysicsController()->GetOrientation();
|
|
||||||
dir = basis*dir;
|
|
||||||
}
|
|
||||||
character->SetWalkDirection(dir/parent->GetScene()->GetPhysicsEnvironment()->GetNumTimeSubSteps());
|
character->SetWalkDirection(dir/parent->GetScene()->GetPhysicsEnvironment()->GetNumTimeSubSteps());
|
||||||
|
|
||||||
if (!m_bitLocalFlag.ZeroDRot)
|
if (!m_bitLocalFlag.ZeroDRot)
|
||||||
|
Loading…
Reference in New Issue
Block a user