Core/Movement: Fixed Facing* splines on transports

This commit is contained in:
Shauren
2012-06-03 15:31:37 +02:00
parent 7a5e4dd585
commit 3b44401aa6
2 changed files with 13 additions and 3 deletions
@@ -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();
}
}