Core/Movement: Fixed Facing* splines on transports
This commit is contained in:
@@ -138,6 +138,14 @@ namespace Movement
|
||||
|
||||
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.flags.EnableFacingAngle();
|
||||
}
|
||||
|
||||
@@ -166,9 +166,11 @@ namespace Movement
|
||||
|
||||
inline void MoveSplineInit::SetFacing(Vector3 const& spot)
|
||||
{
|
||||
args.facing.f.x = spot.x;
|
||||
args.facing.f.y = spot.y;
|
||||
args.facing.f.z = spot.z;
|
||||
TransportPathTransform transform(unit);
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user