TraceRes
From GMod Wiki
Revision as of 17:25, 26 June 2011 by [TNS-M] Wintows (Talk | contribs)
| Structure | |
| Name | TraceRes |
| Available On: | |
| Description: | |
| The results of a trace are contained in the structure of this table. | |
Members
| Name | Type | Description |
|---|---|---|
| Entity | Entity | Returns the entity the trace hit. Use Entity:IsWorld() to check if you hit the world. |
| Fraction | Float | This is a number between 0 and 1. Ex. 0.01 = 1/100 of your tracer's max range. |
| FractionLeftSolid | Float | If the trace starts in a solid, this describes when the trace leaves it as a fraction of the trace distance. |
| Hit | Boolean | Returns true if the trace hits something, false if it stops dead in the air. |
| HitBox | Integer | Appears to be an alias of HitGroup. |
| HitGroup | Integer | Number that corresponds with a hitgroup enumeration. |
| HitNoDraw | Boolean | Returns true if the trace hit a no-draw brush in the world. |
| HitNonWorld | Boolean | This is true if anything other than the world was hit - this can be used for detecting entities. |
| HitNormal | Vector | This is a normalized vector that is perpendicular to the surface you hit. This is used, for example, when right-clicking with rope-based constraints. |
| HitPos | Vector | This is a vector that describes the X, Y, Z position the trace hit in the world. If the trace didn't hit anything, this will be the maximum length of the trace. |
| HitSky | Boolean | If the trace hits the sky, this returns true. |
| HitTexture | String | This is the texture that the trace hit. Returns "**studio**" if it hits an entity or player, "**empty**" if the trace hits nothing, "**displacement**" if the trace hits a displacement surface. |
| HitWorld | Boolean | If the trace hits the world, returns true. If it hits an entity, returns false. |
| MatType | Integer | This is a number that corresponds with a material enumeration. It describes the type of material you hit. NOTE; Metrocop heads have an unlisted enumeration number of 45. |
| Normal | Vector | Equivalent to (traceRes.HitPos - traceRes.StartPos):Normalize(). This vector points in the direction the trace traveled from start to finish. |
| PhysicsBone | Integer | This is the ID number of the physics bone in a ragdoll. This is 0 in all cases not dealing with ragdolls. |
| StartPos | Vector | This is a vector representing the X, Y, Z position the trace started at. |
| StartSolid | Boolean | Indicates if the trace started within a solid, such as a brush or a player. |
Examples