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

◆ FindCollisionDirection()

static bool Terraria.Collision.FindCollisionDirection ( out int Direction,
Vector2 position,
int Width,
int Height,
bool fallThrough = false,
bool fall2 = false,
int gravDir = 1 )
inlinestatic

Definition at line 2191 of file Collision.cs.

2192 {
2193 Vector2 vector = Vector2.UnitX * 16f;
2194 if (TileCollision(position - vector, vector, Width, Height, fallThrough, fall2, gravDir) != vector)
2195 {
2196 Direction = 0;
2197 return true;
2198 }
2199 vector = -Vector2.UnitX * 16f;
2200 if (TileCollision(position - vector, vector, Width, Height, fallThrough, fall2, gravDir) != vector)
2201 {
2202 Direction = 1;
2203 return true;
2204 }
2205 vector = Vector2.UnitY * 16f;
2206 if (TileCollision(position - vector, vector, Width, Height, fallThrough, fall2, gravDir) != vector)
2207 {
2208 Direction = 2;
2209 return true;
2210 }
2211 vector = -Vector2.UnitY * 16f;
2212 if (TileCollision(position - vector, vector, Width, Height, fallThrough, fall2, gravDir) != vector)
2213 {
2214 Direction = 3;
2215 return true;
2216 }
2217 Direction = -1;
2218 return false;
2219 }
static Vector2 TileCollision(Vector2 Position, Vector2 Velocity, int Width, int Height, bool fallThrough=false, bool fall2=false, int gravDir=1)

References Terraria.Collision.TileCollision().