mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
Core/GameObjects: Fixed crash with transport gameobjects that have only 1 entry in TransportAnimation/TransportRotation db2
Closes #28673
This commit is contained in:
@@ -304,10 +304,15 @@ public:
|
||||
G3D::Vector3 prev(oldAnimation->Pos.X, oldAnimation->Pos.Y, oldAnimation->Pos.Z);
|
||||
G3D::Vector3 next(newAnimation->Pos.X, newAnimation->Pos.Y, newAnimation->Pos.Z);
|
||||
|
||||
float animProgress = float(newProgress - oldAnimation->TimeIndex) / float(newAnimation->TimeIndex - oldAnimation->TimeIndex);
|
||||
G3D::Vector3 dst = next;
|
||||
if (prev != next)
|
||||
{
|
||||
float animProgress = float(newProgress - oldAnimation->TimeIndex) / float(newAnimation->TimeIndex - oldAnimation->TimeIndex);
|
||||
|
||||
G3D::Vector3 dst = prev.lerp(next, animProgress) * pathRotation;
|
||||
dst = prev.lerp(next, animProgress);
|
||||
}
|
||||
|
||||
dst = dst * pathRotation;
|
||||
dst += PositionToVector3(&_owner.GetStationaryPosition());
|
||||
|
||||
_owner.GetMap()->GameObjectRelocation(&_owner, dst.x, dst.y, dst.z, _owner.GetOrientation());
|
||||
@@ -320,9 +325,14 @@ public:
|
||||
G3D::Quat prev(oldRotation->Rot[0], oldRotation->Rot[1], oldRotation->Rot[2], oldRotation->Rot[3]);
|
||||
G3D::Quat next(newRotation->Rot[0], newRotation->Rot[1], newRotation->Rot[2], newRotation->Rot[3]);
|
||||
|
||||
float animProgress = float(newProgress - oldRotation->TimeIndex) / float(newRotation->TimeIndex - oldRotation->TimeIndex);
|
||||
G3D::Quat rotation = next;
|
||||
|
||||
G3D::Quat rotation = prev.slerp(next, animProgress);
|
||||
if (prev != next)
|
||||
{
|
||||
float animProgress = float(newProgress - oldRotation->TimeIndex) / float(newRotation->TimeIndex - oldRotation->TimeIndex);
|
||||
|
||||
rotation = prev.slerp(next, animProgress);
|
||||
}
|
||||
|
||||
_owner.SetLocalRotation(rotation.x, rotation.y, rotation.z, rotation.w);
|
||||
_owner.UpdateModelPosition();
|
||||
|
||||
Reference in New Issue
Block a user