Core/Movement: Fixed Facing* splines on transports
This commit is contained in:
@@ -138,6 +138,14 @@ namespace Movement
|
|||||||
|
|
||||||
void MoveSplineInit::SetFacing(float angle)
|
void MoveSplineInit::SetFacing(float angle)
|
||||||
{
|
{
|
||||||
|
if (unit.HasUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT))
|
||||||
|
{
|
||||||
|
if (Unit* vehicle = unit.GetVehicleBase())
|
||||||
|
angle -= vehicle->GetOrientation();
|
||||||
|
else if (Transport* transport = unit.GetTransport())
|
||||||
|
angle -= transport->GetOrientation();
|
||||||
|
}
|
||||||
|
|
||||||
args.facing.angle = G3D::wrap(angle, 0.f, (float)G3D::twoPi());
|
args.facing.angle = G3D::wrap(angle, 0.f, (float)G3D::twoPi());
|
||||||
args.flags.EnableFacingAngle();
|
args.flags.EnableFacingAngle();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -166,9 +166,11 @@ namespace Movement
|
|||||||
|
|
||||||
inline void MoveSplineInit::SetFacing(Vector3 const& spot)
|
inline void MoveSplineInit::SetFacing(Vector3 const& spot)
|
||||||
{
|
{
|
||||||
args.facing.f.x = spot.x;
|
TransportPathTransform transform(unit);
|
||||||
args.facing.f.y = spot.y;
|
Vector3 finalSpot = transform(spot);
|
||||||
args.facing.f.z = spot.z;
|
args.facing.f.x = finalSpot.x;
|
||||||
|
args.facing.f.y = finalSpot.y;
|
||||||
|
args.facing.f.z = finalSpot.z;
|
||||||
args.flags.EnableFacingPoint();
|
args.flags.EnableFacingPoint();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user