Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ TrackRotation()

static float Terraria.Minecart.TrackRotation ( Player player,
ref float rotation,
Vector2 Position,
int Width,
int Height,
bool followDown,
bool followUp,
Mount::MountDelegatesData delegatesData )
inlinestatic

Definition at line 1248 of file Minecart.cs.

1249 {
1250 GetWheelsPositions(player, Position, Width, Height, followDown, followUp, delegatesData, out var leftWheel, out var rightWheel);
1251 float num = rightWheel.Y - leftWheel.Y;
1252 float num2 = rightWheel.X - leftWheel.X;
1253 float num3 = num / num2;
1254 float num4 = leftWheel.Y + (Position.X - leftWheel.X) * num3;
1255 float num5 = (Position.X - (float)(int)Position.X) * num3;
1256 rotation = (float)Math.Atan2(num, num2);
1257 return num4 - Position.Y + num5;
1258 }
static double Atan2(double y, double x)
static void GetWheelsPositions(Player player, Vector2 Position, int Width, int Height, bool followDown, bool followUp, Mount.MountDelegatesData delegatesData, out Vector2 leftWheel, out Vector2 rightWheel)
Definition Minecart.cs:1260

References System.Math.Atan2(), and Terraria.Minecart.GetWheelsPositions().

Referenced by Terraria.Player.Update().