Core/Movement
* Moved enter/exit vehicle packets to spline. * Fixed spline movement on transports such as elevators (for which we do not keep track of its exact position) - path will be using normal coordinates (not transport offsets)
This commit is contained in:
@@ -424,50 +424,6 @@ void Unit::DisableSpline()
|
||||
movespline->_Interrupt();
|
||||
}
|
||||
|
||||
void Unit::SendMonsterMoveExitVehicle(Position const* newPos)
|
||||
{
|
||||
WorldPacket data(SMSG_MONSTER_MOVE, 1+12+4+1+4+4+4+12+GetPackGUID().size());
|
||||
data.append(GetPackGUID());
|
||||
|
||||
data << uint8(GetTypeId() == TYPEID_PLAYER ? 1 : 0); // sets/unsets MOVEMENTFLAG2_UNK7 (0x40)
|
||||
data << GetPositionX() << GetPositionY() << GetPositionZ();
|
||||
data << getMSTime();
|
||||
|
||||
data << uint8(SPLINETYPE_FACING_ANGLE);
|
||||
data << float(GetOrientation()); // guess
|
||||
data << uint32(SPLINEFLAG_TRANSPORT_EXIT);
|
||||
data << uint32(0); // Time in between points
|
||||
data << uint32(1); // 1 single waypoint
|
||||
data << newPos->GetPositionX();
|
||||
data << newPos->GetPositionY();
|
||||
data << newPos->GetPositionZ();
|
||||
|
||||
SendMessageToSet(&data, true);
|
||||
}
|
||||
|
||||
void Unit::SendMonsterMoveTransport(Unit* vehicleOwner)
|
||||
{
|
||||
// TODO: Turn into BuildMonsterMoveTransport packet and allow certain variables (for npc movement aboard vehicles)
|
||||
WorldPacket data(SMSG_MONSTER_MOVE_TRANSPORT, GetPackGUID().size()+vehicleOwner->GetPackGUID().size() + 47);
|
||||
data.append(GetPackGUID());
|
||||
data.append(vehicleOwner->GetPackGUID());
|
||||
data << int8(GetTransSeat());
|
||||
data << uint8(0); // sets/unsets MOVEMENTFLAG2_UNK7 (0x40)
|
||||
data << GetPositionX() - vehicleOwner->GetPositionX();
|
||||
data << GetPositionY() - vehicleOwner->GetPositionY();
|
||||
data << GetPositionZ() - vehicleOwner->GetPositionZ();
|
||||
data << uint32(getMSTime()); // should be an increasing constant that indicates movement packet count
|
||||
data << uint8(SPLINETYPE_FACING_ANGLE);
|
||||
data << GetTransOffsetO(); // facing angle?
|
||||
data << uint32(SPLINEFLAG_TRANSPORT);
|
||||
data << uint32(GetTransTime()); // move time
|
||||
data << uint32(1); // amount of waypoints
|
||||
data << uint32(0); // waypoint X
|
||||
data << uint32(0); // waypoint Y
|
||||
data << uint32(0); // waypoint Z
|
||||
SendMessageToSet(&data, true);
|
||||
}
|
||||
|
||||
void Unit::resetAttackTimer(WeaponAttackType type)
|
||||
{
|
||||
m_attackTimer[type] = uint32(GetAttackTime(type) * m_modAttackSpeedPct[type]);
|
||||
@@ -16308,7 +16264,7 @@ Creature* Unit::GetVehicleCreatureBase() const
|
||||
uint64 Unit::GetTransGUID() const
|
||||
{
|
||||
if (GetVehicle())
|
||||
return GetVehicle()->GetBase()->GetGUID();
|
||||
return GetVehicleBase()->GetGUID();
|
||||
if (GetTransport())
|
||||
return GetTransport()->GetGUID();
|
||||
|
||||
@@ -17171,11 +17127,12 @@ void Unit::_ExitVehicle(Position const* exitPosition)
|
||||
Vehicle* vehicle = m_vehicle;
|
||||
m_vehicle = NULL;
|
||||
|
||||
SetControlled(false, UNIT_STATE_ROOT); // SMSG_MOVE_FORCE_UNROOT, ~MOVEMENTFLAG_ROOT
|
||||
SetControlled(false, UNIT_STATE_ROOT); // SMSG_MOVE_FORCE_UNROOT, ~MOVEMENTFLAG_ROOT
|
||||
|
||||
Position pos;
|
||||
if (!exitPosition) // Exit position not specified
|
||||
vehicle->GetBase()->GetPosition(&pos);
|
||||
if (!exitPosition) // Exit position not specified
|
||||
vehicle->GetBase()->GetPosition(&pos); // This should use passenger's current position, leaving it as it is now
|
||||
// because we calculate positions incorrect (sometimes under map)
|
||||
else
|
||||
pos = *exitPosition;
|
||||
|
||||
@@ -17190,14 +17147,17 @@ void Unit::_ExitVehicle(Position const* exitPosition)
|
||||
SendMessageToSet(&data, false);
|
||||
}
|
||||
|
||||
SendMonsterMoveExitVehicle(&pos);
|
||||
Relocate(&pos);
|
||||
Movement::MoveSplineInit init(*this);
|
||||
init.MoveTo(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ());
|
||||
init.SetFacing(GetOrientation());
|
||||
init.SetTransportExit();
|
||||
init.Launch();
|
||||
|
||||
//GetMotionMaster()->MoveFall(); // Enable this once passenger positions are calculater properly (see above)
|
||||
|
||||
if (Player* player = ToPlayer())
|
||||
player->ResummonPetTemporaryUnSummonedIfAny();
|
||||
|
||||
SendMovementFlagUpdate();
|
||||
|
||||
if (vehicle->GetBase()->HasUnitTypeMask(UNIT_MASK_MINION))
|
||||
if (((Minion*)vehicle->GetBase())->GetOwner() == this)
|
||||
vehicle->Dismiss();
|
||||
|
||||
@@ -735,52 +735,6 @@ enum MovementFlags2
|
||||
MOVEMENTFLAG2_UNK16 = 0x00008000,
|
||||
};
|
||||
|
||||
enum SplineFlags
|
||||
{
|
||||
SPLINEFLAG_NONE = 0x00000000,
|
||||
SPLINEFLAG_FORWARD = 0x00000001,
|
||||
SPLINEFLAG_BACKWARD = 0x00000002,
|
||||
SPLINEFLAG_STRAFE_LEFT = 0x00000004,
|
||||
SPLINEFLAG_STRAFE_RIGHT = 0x00000008,
|
||||
SPLINEFLAG_TURN_LEFT = 0x00000010,
|
||||
SPLINEFLAG_TURN_RIGHT = 0x00000020,
|
||||
SPLINEFLAG_PITCH_UP = 0x00000040,
|
||||
SPLINEFLAG_PITCH_DOWN = 0x00000080,
|
||||
SPLINEFLAG_DONE = 0x00000100,
|
||||
SPLINEFLAG_FALLING = 0x00000200,
|
||||
SPLINEFLAG_NO_SPLINE = 0x00000400,
|
||||
SPLINEFLAG_TRAJECTORY = 0x00000800,
|
||||
SPLINEFLAG_WALK_MODE = 0x00001000,
|
||||
SPLINEFLAG_FLYING = 0x00002000,
|
||||
SPLINEFLAG_KNOCKBACK = 0x00004000,
|
||||
SPLINEFLAG_FINAL_POINT = 0x00008000,
|
||||
SPLINEFLAG_FINAL_TARGET = 0x00010000,
|
||||
SPLINEFLAG_FINAL_FACING = 0x00020000,
|
||||
SPLINEFLAG_CATMULL_ROM = 0x00040000,
|
||||
SPLINEFLAG_CYCLIC = 0x00080000,
|
||||
SPLINEFLAG_ENTER_CYCLE = 0x00100000,
|
||||
SPLINEFLAG_ANIMATION_TIER = 0x00200000,
|
||||
SPLINEFLAG_FROZEN = 0x00400000,
|
||||
SPLINEFLAG_TRANSPORT = 0x00800000,
|
||||
SPLINEFLAG_TRANSPORT_EXIT = 0x01000000,
|
||||
SPLINEFLAG_UNKNOWN7 = 0x02000000,
|
||||
SPLINEFLAG_UNKNOWN8 = 0x04000000,
|
||||
SPLINEFLAG_ORIENTATION_INVERTED = 0x08000000,
|
||||
SPLINEFLAG_USE_PATH_SMOOTHING = 0x10000000,
|
||||
SPLINEFLAG_ANIMATION = 0x20000000,
|
||||
SPLINEFLAG_UNCOMPRESSED_PATH = 0x40000000,
|
||||
SPLINEFLAG_UNKNOWN10 = 0x80000000,
|
||||
};
|
||||
|
||||
enum SplineType
|
||||
{
|
||||
SPLINETYPE_NORMAL = 0,
|
||||
SPLINETYPE_STOP = 1,
|
||||
SPLINETYPE_FACING_SPOT = 2,
|
||||
SPLINETYPE_FACING_TARGET = 3,
|
||||
SPLINETYPE_FACING_ANGLE = 4,
|
||||
};
|
||||
|
||||
enum UnitTypeMask
|
||||
{
|
||||
UNIT_MASK_NONE = 0x00000000,
|
||||
@@ -1662,9 +1616,7 @@ class Unit : public WorldObject
|
||||
|
||||
void MonsterMoveWithSpeed(float x, float y, float z, float speed);
|
||||
//void SetFacing(float ori, WorldObject* obj = NULL);
|
||||
void SendMonsterMoveExitVehicle(Position const* newPos);
|
||||
//void SendMonsterMove(float NewPosX, float NewPosY, float NewPosZ, uint8 type, uint32 MovementFlags, uint32 Time, Player* player = NULL);
|
||||
void SendMonsterMoveTransport(Unit* vehicleOwner);
|
||||
void SendMovementFlagUpdate();
|
||||
|
||||
/*! These methods send the same packet to the client in apply and unapply case.
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
#include "ZoneScript.h"
|
||||
#include "SpellMgr.h"
|
||||
#include "SpellInfo.h"
|
||||
#include "MoveSplineInit.h"
|
||||
|
||||
Vehicle::Vehicle(Unit* unit, VehicleEntry const* vehInfo, uint32 creatureEntry) : _me(unit), _vehicleInfo(vehInfo), _usableSeatNum(0), _creatureEntry(creatureEntry)
|
||||
{
|
||||
@@ -364,7 +365,12 @@ bool Vehicle::AddPassenger(Unit* unit, int8 seatId)
|
||||
unit->SendClearTarget(); // SMSG_BREAK_TARGET
|
||||
unit->SetControlled(true, UNIT_STATE_ROOT); // SMSG_FORCE_ROOT - In some cases we send SMSG_SPLINE_MOVE_ROOT here (for creatures)
|
||||
// also adds MOVEMENTFLAG_ROOT
|
||||
unit->SendMonsterMoveTransport(_me); // SMSG_MONSTER_MOVE_TRANSPORT
|
||||
Movement::MoveSplineInit init(*unit);
|
||||
init.DisableTransportPathTransformations();
|
||||
init.MoveTo(veSeat->m_attachmentOffsetX, veSeat->m_attachmentOffsetY, veSeat->m_attachmentOffsetZ);
|
||||
init.SetFacing(0.0f);
|
||||
init.SetTransportEnter();
|
||||
init.Launch();
|
||||
|
||||
if (_me->GetTypeId() == TYPEID_UNIT)
|
||||
{
|
||||
@@ -372,7 +378,8 @@ bool Vehicle::AddPassenger(Unit* unit, int8 seatId)
|
||||
_me->ToCreature()->AI()->PassengerBoarded(unit, seat->first, true);
|
||||
|
||||
// update all passenger's positions
|
||||
RelocatePassengers(_me->GetPositionX(), _me->GetPositionY(), _me->GetPositionZ(), _me->GetOrientation());
|
||||
//Passenger's spline OR vehicle movement will update positions
|
||||
//RelocatePassengers(_me->GetPositionX(), _me->GetPositionY(), _me->GetPositionZ(), _me->GetOrientation());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -34,43 +34,43 @@ namespace Movement
|
||||
{
|
||||
public:
|
||||
enum eFlags{
|
||||
None = 0x00000000,
|
||||
// x00-xFF(first byte) used as animation Ids storage in pair with Animation flag
|
||||
Done = 0x00000100,
|
||||
Falling = 0x00000200, // Affects elevation computation, can't be combined with Parabolic flag
|
||||
No_Spline = 0x00000400,
|
||||
Parabolic = 0x00000800, // Affects elevation computation, can't be combined with Falling flag
|
||||
Walkmode = 0x00001000,
|
||||
Flying = 0x00002000, // Smooth movement(Catmullrom interpolation mode), flying animation
|
||||
OrientationFixed = 0x00004000, // Model orientation fixed
|
||||
Final_Point = 0x00008000,
|
||||
Final_Target = 0x00010000,
|
||||
Final_Angle = 0x00020000,
|
||||
Catmullrom = 0x00040000, // Used Catmullrom interpolation mode
|
||||
Cyclic = 0x00080000, // Movement by cycled spline
|
||||
Enter_Cycle = 0x00100000, // Everytimes appears with cyclic flag in monster move packet, erases first spline vertex after first cycle done
|
||||
Animation = 0x00200000, // Plays animation after some time passed
|
||||
Frozen = 0x00400000, // Will never arrive
|
||||
Unknown5 = 0x00800000,
|
||||
Unknown6 = 0x01000000,
|
||||
Unknown7 = 0x02000000,
|
||||
Unknown8 = 0x04000000,
|
||||
None = 0x00000000,
|
||||
// x00-xFF(first byte) used as animation Ids storage in pair with Animation flag
|
||||
Done = 0x00000100,
|
||||
Falling = 0x00000200, // Affects elevation computation, can't be combined with Parabolic flag
|
||||
No_Spline = 0x00000400,
|
||||
Parabolic = 0x00000800, // Affects elevation computation, can't be combined with Falling flag
|
||||
Walkmode = 0x00001000,
|
||||
Flying = 0x00002000, // Smooth movement(Catmullrom interpolation mode), flying animation
|
||||
OrientationFixed = 0x00004000, // Model orientation fixed
|
||||
Final_Point = 0x00008000,
|
||||
Final_Target = 0x00010000,
|
||||
Final_Angle = 0x00020000,
|
||||
Catmullrom = 0x00040000, // Used Catmullrom interpolation mode
|
||||
Cyclic = 0x00080000, // Movement by cycled spline
|
||||
Enter_Cycle = 0x00100000, // Everytimes appears with cyclic flag in monster move packet, erases first spline vertex after first cycle done
|
||||
Animation = 0x00200000, // Plays animation after some time passed
|
||||
Frozen = 0x00400000, // Will never arrive
|
||||
TransportEnter = 0x00800000,
|
||||
TransportExit = 0x01000000,
|
||||
Unknown7 = 0x02000000,
|
||||
Unknown8 = 0x04000000,
|
||||
OrientationInversed = 0x08000000,
|
||||
Unknown10 = 0x10000000,
|
||||
Unknown11 = 0x20000000,
|
||||
Unknown12 = 0x40000000,
|
||||
Unknown13 = 0x80000000,
|
||||
Unknown10 = 0x10000000,
|
||||
Unknown11 = 0x20000000,
|
||||
Unknown12 = 0x40000000,
|
||||
Unknown13 = 0x80000000,
|
||||
|
||||
// Masks
|
||||
Mask_Final_Facing = Final_Point | Final_Target | Final_Angle,
|
||||
Mask_Final_Facing = Final_Point | Final_Target | Final_Angle,
|
||||
// animation ids stored here, see AnimType enum, used with Animation flag
|
||||
Mask_Animations = 0xFF,
|
||||
Mask_Animations = 0xFF,
|
||||
// flags that shouldn't be appended into SMSG_MONSTER_MOVE\SMSG_MONSTER_MOVE_TRANSPORT packet, should be more probably
|
||||
Mask_No_Monster_Move = Mask_Final_Facing | Mask_Animations | Done,
|
||||
// CatmullRom interpolation mode used
|
||||
Mask_CatmullRom = Flying | Catmullrom,
|
||||
Mask_CatmullRom = Flying | Catmullrom,
|
||||
// Unused, not suported flags
|
||||
Mask_Unused = No_Spline|Enter_Cycle|Frozen|Unknown5|Unknown6|Unknown7|Unknown8|Unknown10|Unknown11|Unknown12|Unknown13,
|
||||
Mask_Unused = No_Spline|Enter_Cycle|Frozen|Unknown7|Unknown8|Unknown10|Unknown11|Unknown12|Unknown13,
|
||||
};
|
||||
|
||||
inline uint32& raw() { return (uint32&)*this;}
|
||||
@@ -98,14 +98,16 @@ namespace Movement
|
||||
void operator &= (uint32 f) { raw() &= f;}
|
||||
void operator |= (uint32 f) { raw() |= f;}
|
||||
|
||||
void EnableAnimation(uint8 anim) { raw() = (raw() & ~(Mask_Animations|Falling|Parabolic)) | Animation|anim;}
|
||||
void EnableParabolic() { raw() = (raw() & ~(Mask_Animations|Falling|Animation)) | Parabolic;}
|
||||
void EnableFalling() { raw() = (raw() & ~(Mask_Animations|Parabolic|Animation)) | Falling;}
|
||||
void EnableAnimation(uint8 anim) { raw() = (raw() & ~(Mask_Animations | Falling | Parabolic)) | Animation | anim; }
|
||||
void EnableParabolic() { raw() = (raw() & ~(Mask_Animations | Falling | Animation)) | Parabolic; }
|
||||
void EnableFalling() { raw() = (raw() & ~(Mask_Animations | Parabolic | Animation)) | Falling; }
|
||||
void EnableFlying() { raw() = (raw() & ~Catmullrom) | Flying; }
|
||||
void EnableCatmullRom() { raw() = (raw() & ~Flying) | Catmullrom; }
|
||||
void EnableFacingPoint() { raw() = (raw() & ~Mask_Final_Facing) | Final_Point;}
|
||||
void EnableFacingAngle() { raw() = (raw() & ~Mask_Final_Facing) | Final_Angle;}
|
||||
void EnableFacingTarget() { raw() = (raw() & ~Mask_Final_Facing) | Final_Target;}
|
||||
void EnableFacingPoint() { raw() = (raw() & ~Mask_Final_Facing) | Final_Point; }
|
||||
void EnableFacingAngle() { raw() = (raw() & ~Mask_Final_Facing) | Final_Angle; }
|
||||
void EnableFacingTarget() { raw() = (raw() & ~Mask_Final_Facing) | Final_Target; }
|
||||
void EnableTransportEnter() { raw() = (raw() & ~TransportExit) | TransportEnter; }
|
||||
void EnableTransportExit() { raw() = (raw() & ~TransportEnter) | TransportExit; }
|
||||
|
||||
uint8 animId : 8;
|
||||
bool done : 1;
|
||||
@@ -123,8 +125,8 @@ namespace Movement
|
||||
bool enter_cycle : 1;
|
||||
bool animation : 1;
|
||||
bool frozen : 1;
|
||||
bool unknown5 : 1;
|
||||
bool unknown6 : 1;
|
||||
bool transportEnter: 1;
|
||||
bool transportExit : 1;
|
||||
bool unknown7 : 1;
|
||||
bool unknown8 : 1;
|
||||
bool orientationInversed : 1;
|
||||
|
||||
@@ -62,7 +62,8 @@ namespace Movement
|
||||
|
||||
bool transport = false;
|
||||
Location real_position(unit.GetPositionX(), unit.GetPositionY(), unit.GetPositionZMinusOffset(), unit.GetOrientation());
|
||||
if (unit.HasUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT))
|
||||
// Elevators also use MOVEMENTFLAG_ONTRANSPORT but we do not keep track of their position changes
|
||||
if (unit.HasUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT) && unit.GetTransGUID())
|
||||
{
|
||||
transport = true;
|
||||
real_position.x = unit.GetTransOffsetX();
|
||||
@@ -108,13 +109,7 @@ namespace Movement
|
||||
data.append(unit.GetPackGUID());
|
||||
if (transport)
|
||||
{
|
||||
if (unit.GetVehicle())
|
||||
data.appendPackGUID(unit.GetVehicleBase()->GetGUID());
|
||||
else if (unit.GetTransport())
|
||||
data.appendPackGUID(unit.GetTransGUID());
|
||||
else
|
||||
data << uint8(0);
|
||||
|
||||
data.appendPackGUID(unit.GetTransGUID());
|
||||
data << int8(unit.GetTransSeat());
|
||||
}
|
||||
|
||||
@@ -124,6 +119,8 @@ namespace Movement
|
||||
|
||||
MoveSplineInit::MoveSplineInit(Unit& m) : unit(m)
|
||||
{
|
||||
// Elevators also use MOVEMENTFLAG_ONTRANSPORT but we do not keep track of their position changes
|
||||
args.TransformForTransport = unit.HasUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT) && unit.GetTransGUID();
|
||||
// mix existing state into new
|
||||
args.flags.walkmode = unit.m_movementInfo.HasMovementFlag(MOVEMENTFLAG_WALKING);
|
||||
args.flags.flying = unit.m_movementInfo.HasMovementFlag((MovementFlags)(MOVEMENTFLAG_CAN_FLY|MOVEMENTFLAG_DISABLE_GRAVITY));
|
||||
@@ -138,7 +135,7 @@ namespace Movement
|
||||
|
||||
void MoveSplineInit::SetFacing(float angle)
|
||||
{
|
||||
if (unit.HasUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT))
|
||||
if (args.TransformForTransport)
|
||||
{
|
||||
if (Unit* vehicle = unit.GetVehicleBase())
|
||||
angle -= vehicle->GetOrientation();
|
||||
@@ -154,13 +151,13 @@ namespace Movement
|
||||
{
|
||||
args.path_Idx_offset = 0;
|
||||
args.path.resize(2);
|
||||
TransportPathTransform transform(unit);
|
||||
TransportPathTransform transform(unit, args.TransformForTransport);
|
||||
args.path[1] = transform(dest);
|
||||
}
|
||||
|
||||
Vector3 TransportPathTransform::operator()(Vector3 input)
|
||||
{
|
||||
if (_owner.HasUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT))
|
||||
if (_transformForTransport)
|
||||
{
|
||||
if (Unit* vehicle = _owner.GetVehicleBase())
|
||||
{
|
||||
@@ -177,5 +174,4 @@ namespace Movement
|
||||
|
||||
return input;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -37,11 +37,13 @@ namespace Movement
|
||||
class TransportPathTransform
|
||||
{
|
||||
public:
|
||||
TransportPathTransform(Unit& owner) : _owner(owner) { }
|
||||
TransportPathTransform(Unit& owner, bool transformForTransport)
|
||||
: _owner(owner), _transformForTransport(transformForTransport) { }
|
||||
Vector3 operator()(Vector3 input);
|
||||
|
||||
private:
|
||||
Unit& _owner;
|
||||
bool _transformForTransport;
|
||||
};
|
||||
|
||||
/* Initializes and launches spline movement
|
||||
@@ -107,6 +109,12 @@ namespace Movement
|
||||
/* Enables falling mode. Disabled by default
|
||||
*/
|
||||
void SetFall();
|
||||
/* Enters transport. Disabled by default
|
||||
*/
|
||||
void SetTransportEnter();
|
||||
/* Exits transport. Disabled by default
|
||||
*/
|
||||
void SetTransportExit();
|
||||
/* Inverses unit model orientation. Disabled by default
|
||||
*/
|
||||
void SetOrientationInversed();
|
||||
@@ -123,31 +131,36 @@ namespace Movement
|
||||
|
||||
PointsArray& Path() { return args.path; }
|
||||
|
||||
/* Disables transport coordinate transformations for cases where raw offsets are available
|
||||
*/
|
||||
void DisableTransportPathTransformations();
|
||||
protected:
|
||||
|
||||
MoveSplineInitArgs args;
|
||||
Unit& unit;
|
||||
};
|
||||
|
||||
inline void MoveSplineInit::SetFly() { args.flags.EnableFlying();}
|
||||
inline void MoveSplineInit::SetFly() { args.flags.EnableFlying(); }
|
||||
inline void MoveSplineInit::SetWalk(bool enable) { args.flags.walkmode = enable;}
|
||||
inline void MoveSplineInit::SetSmooth() { args.flags.EnableCatmullRom();}
|
||||
inline void MoveSplineInit::SetCyclic() { args.flags.cyclic = true;}
|
||||
inline void MoveSplineInit::SetFall() { args.flags.EnableFalling();}
|
||||
inline void MoveSplineInit::SetVelocity(float vel) { args.velocity = vel; args.HasVelocity = true; }
|
||||
inline void MoveSplineInit::SetOrientationInversed() { args.flags.orientationInversed = true;}
|
||||
inline void MoveSplineInit::SetTransportEnter() { args.flags.EnableTransportEnter(); }
|
||||
inline void MoveSplineInit::SetTransportExit() { args.flags.EnableTransportExit(); }
|
||||
inline void MoveSplineInit::SetOrientationFixed(bool enable) { args.flags.orientationFixed = enable;}
|
||||
|
||||
inline void MoveSplineInit::MovebyPath(const PointsArray& controls, int32 path_offset)
|
||||
{
|
||||
args.path_Idx_offset = path_offset;
|
||||
args.path.resize(controls.size());
|
||||
std::transform(controls.begin(), controls.end(), args.path.begin(), TransportPathTransform(unit));
|
||||
std::transform(controls.begin(), controls.end(), args.path.begin(), TransportPathTransform(unit, args.TransformForTransport));
|
||||
}
|
||||
|
||||
inline void MoveSplineInit::MoveTo(float x, float y, float z)
|
||||
{
|
||||
Vector3 v(x,y,z);
|
||||
Vector3 v(x, y, z);
|
||||
MoveTo(v);
|
||||
}
|
||||
|
||||
@@ -166,12 +179,14 @@ namespace Movement
|
||||
|
||||
inline void MoveSplineInit::SetFacing(Vector3 const& spot)
|
||||
{
|
||||
TransportPathTransform transform(unit);
|
||||
TransportPathTransform transform(unit, args.TransformForTransport);
|
||||
Vector3 finalSpot = transform(spot);
|
||||
args.facing.f.x = finalSpot.x;
|
||||
args.facing.f.y = finalSpot.y;
|
||||
args.facing.f.z = finalSpot.z;
|
||||
args.flags.EnableFacingPoint();
|
||||
}
|
||||
|
||||
inline void MoveSplineInit::DisableTransportPathTransformations() { args.TransformForTransport = false; }
|
||||
}
|
||||
#endif // TRINITYSERVER_MOVESPLINEINIT_H
|
||||
|
||||
@@ -42,7 +42,8 @@ namespace Movement
|
||||
struct MoveSplineInitArgs
|
||||
{
|
||||
MoveSplineInitArgs(size_t path_capacity = 16) : path_Idx_offset(0),
|
||||
velocity(0.f), parabolic_amplitude(0.f), time_perc(0.f), splineId(0), initialOrientation(0.f), HasVelocity(false)
|
||||
velocity(0.f), parabolic_amplitude(0.f), time_perc(0.f), splineId(0), initialOrientation(0.f),
|
||||
HasVelocity(false), TransformForTransport(true)
|
||||
{
|
||||
path.reserve(path_capacity);
|
||||
}
|
||||
@@ -57,6 +58,7 @@ namespace Movement
|
||||
uint32 splineId;
|
||||
float initialOrientation;
|
||||
bool HasVelocity;
|
||||
bool TransformForTransport;
|
||||
|
||||
/** Returns true to show that the arguments were configured correctly and MoveSpline initialization will succeed. */
|
||||
bool Validate() const;
|
||||
|
||||
Reference in New Issue
Block a user