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

◆ GetMinecartMechPoint()

static Vector2 Terraria.Mount.GetMinecartMechPoint ( Player mountedPlayer,
int offX,
int offY )
inlinestatic

Definition at line 4445 of file Mount.cs.

4446 {
4447 int num = Math.Sign(mountedPlayer.velocity.X);
4448 if (num == 0)
4449 {
4450 num = mountedPlayer.direction;
4451 }
4452 float num2 = offX;
4453 int num3 = Math.Sign(offX);
4454 if (mountedPlayer.direction != num)
4455 {
4456 num2 -= (float)num3;
4457 }
4458 if (num == -1)
4459 {
4460 num2 -= (float)num3;
4461 }
4462 Vector2 vector = new Vector2(num2 * (float)num, offY).RotatedBy(mountedPlayer.fullRotation);
4463 Vector2 vector2 = new Vector2(MathHelper.Lerp(0f, -8f, mountedPlayer.fullRotation / ((float)Math.PI / 4f)), MathHelper.Lerp(0f, 2f, Math.Abs(mountedPlayer.fullRotation / ((float)Math.PI / 4f)))).RotatedBy(mountedPlayer.fullRotation);
4464 if (num == Math.Sign(mountedPlayer.fullRotation))
4465 {
4466 vector2 *= MathHelper.Lerp(1f, 0.6f, Math.Abs(mountedPlayer.fullRotation / ((float)Math.PI / 4f)));
4467 }
4468 return mountedPlayer.Bottom + vector + vector2;
4469 }
static float Lerp(float value1, float value2, float amount)
Definition MathHelper.cs:53
static double Abs(double value)
const double PI
Definition Math.cs:16
static int Sign(decimal value)
Definition Math.cs:1202

References System.Math.Abs(), Microsoft.Xna.Framework.MathHelper.Lerp(), System.Math.PI, System.Math.Sign(), and Microsoft.Xna.Framework.Graphics.Vector2.

Referenced by Terraria.Mount.CastSuperCartLaser().