Core/GameObjects: Use all axis rotations for gameobject model collision, not just orientation
This commit is contained in:
1 parent
dea1e820f5
commit
338e9d8033
3 files changed
+10
-4
No files matched your search
@@ -22,6 +22,7 @@
|
||||
#include "GameObjectModel.h"
|
||||
#include "Log.h"
|
||||
#include "Timer.h"
|
||||
#include <G3D/Quat.h>
|
||||
|
||||
using G3D::Vector3;
|
||||
using G3D::Ray;
|
||||
@@ -125,7 +126,7 @@ bool GameObjectModel::initialize(std::unique_ptr<GameObjectModelOwnerBase> model
|
||||
iScale = modelOwner->GetScale();
|
||||
iInvScale = 1.f / iScale;
|
||||
|
||||
G3D::Matrix3 iRotation = G3D::Matrix3::fromEulerAnglesZYX(modelOwner->GetOrientation(), 0, 0);
|
||||
G3D::Matrix3 iRotation = modelOwner->GetRotation().toRotationMatrix();
|
||||
iInvRot = iRotation.inverse();
|
||||
// transform bounding box:
|
||||
mdl_box = AABox(mdl_box.low() * iScale, mdl_box.high() * iScale);
|
||||
@@ -203,7 +204,7 @@ bool GameObjectModel::UpdatePosition()
|
||||
|
||||
iPos = owner->GetPosition();
|
||||
|
||||
G3D::Matrix3 iRotation = G3D::Matrix3::fromEulerAnglesZYX(owner->GetOrientation(), 0, 0);
|
||||
G3D::Matrix3 iRotation = owner->GetRotation().toRotationMatrix();
|
||||
iInvRot = iRotation.inverse();
|
||||
// transform bounding box:
|
||||
mdl_box = AABox(mdl_box.low() * iScale, mdl_box.high() * iScale);
|
||||
|
||||
@@ -26,6 +26,11 @@
|
||||
#include "Define.h"
|
||||
#include <memory>
|
||||
|
||||
namespace G3D
|
||||
{
|
||||
class Quat;
|
||||
}
|
||||
|
||||
namespace VMAP
|
||||
{
|
||||
class WorldModel;
|
||||
@@ -45,7 +50,7 @@ public:
|
||||
virtual uint32 GetDisplayId() const = 0;
|
||||
virtual bool IsInPhase(PhaseShift const& /*phaseShift*/) const = 0;
|
||||
virtual G3D::Vector3 GetPosition() const = 0;
|
||||
virtual float GetOrientation() const = 0;
|
||||
virtual G3D::Quat GetRotation() const = 0;
|
||||
virtual float GetScale() const = 0;
|
||||
virtual void DebugVisualizeCorner(G3D::Vector3 const& /*corner*/) const = 0;
|
||||
};
|
||||
|
||||
@@ -3074,7 +3074,7 @@ public:
|
||||
virtual uint32 GetDisplayId() const override { return _owner->GetDisplayId(); }
|
||||
virtual bool IsInPhase(PhaseShift const& phaseShift) const override { return _owner->GetPhaseShift().CanSee(phaseShift); }
|
||||
virtual G3D::Vector3 GetPosition() const override { return G3D::Vector3(_owner->GetPositionX(), _owner->GetPositionY(), _owner->GetPositionZ()); }
|
||||
virtual float GetOrientation() const override { return _owner->GetOrientation(); }
|
||||
G3D::Quat GetRotation() const override { return G3D::Quat(_owner->GetLocalRotation().x, _owner->GetLocalRotation().y, _owner->GetLocalRotation().z, _owner->GetLocalRotation().w); }
|
||||
virtual float GetScale() const override { return _owner->GetObjectScale(); }
|
||||
virtual void DebugVisualizeCorner(G3D::Vector3 const& corner) const override { const_cast<GameObject*>(_owner)->SummonCreature(1, corner.x, corner.y, corner.z, 0, TEMPSUMMON_MANUAL_DESPAWN); }
|
||||
|
||||
|
||||
Reference in new issue
Block a user