Core/GameObjects: Use all axis rotations for gameobject model collision, not just orientation
Port From (https://github.com/TrinityCore/TrinityCore/commit/c13d26e1fa40ac8d40e1b4f7c72e4c1ef3f6c5e8)
This commit is contained in:
@@ -36,7 +36,7 @@ namespace Game.Collision
|
||||
public abstract byte GetNameSetId();
|
||||
public abstract bool IsInPhase(PhaseShift phaseShift);
|
||||
public abstract Vector3 GetPosition();
|
||||
public abstract float GetOrientation();
|
||||
public abstract Quaternion GetRotation();
|
||||
public abstract float GetScale();
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ namespace Game.Collision
|
||||
iScale = modelOwner.GetScale();
|
||||
iInvScale = 1.0f / iScale;
|
||||
|
||||
Matrix4x4 iRotation = Extensions.fromEulerAnglesZYX(modelOwner.GetOrientation(), 0, 0);
|
||||
Matrix4x4 iRotation = Matrix4x4.CreateFromQuaternion(modelOwner.GetRotation());
|
||||
Matrix4x4.Invert(iRotation, out iInvRot);
|
||||
// transform bounding box:
|
||||
mdl_box = new AxisAlignedBox(mdl_box.Lo * iScale, mdl_box.Hi * iScale);
|
||||
@@ -204,7 +204,7 @@ namespace Game.Collision
|
||||
|
||||
iPos = owner.GetPosition();
|
||||
|
||||
Matrix4x4 iRotation = Extensions.fromEulerAnglesZYX(owner.GetOrientation(), 0, 0);
|
||||
Matrix4x4 iRotation = Matrix4x4.CreateFromQuaternion(owner.GetRotation());
|
||||
Matrix4x4.Invert(iRotation, out iInvRot);
|
||||
// transform bounding box:
|
||||
mdl_box = new AxisAlignedBox(mdl_box.Lo * iScale, mdl_box.Hi * iScale);
|
||||
|
||||
@@ -3503,7 +3503,7 @@ namespace Game.Entities
|
||||
public override byte GetNameSetId() { return _owner.GetNameSetId(); }
|
||||
public override bool IsInPhase(PhaseShift phaseShift) { return _owner.GetPhaseShift().CanSee(phaseShift); }
|
||||
public override Vector3 GetPosition() { return new Vector3(_owner.GetPositionX(), _owner.GetPositionY(), _owner.GetPositionZ()); }
|
||||
public override float GetOrientation() { return _owner.GetOrientation(); }
|
||||
public override Quaternion GetRotation() { return new Quaternion(_owner.GetLocalRotation().X, _owner.GetLocalRotation().Y, _owner.GetLocalRotation().Z, _owner.GetLocalRotation().W); }
|
||||
public override float GetScale() { return _owner.GetObjectScale(); }
|
||||
|
||||
GameObject _owner;
|
||||
|
||||
Reference in New Issue
Block a user