Traces are imaginary lines. When you run a Trace you get a TraceResult - which tells you what the line hit.
PhysicsTrace |
Body | Casts a PhysicsBody from its current position and rotation to desired end point. |
Box | Casts a box from point A to point B. |
Capsule | Casts a capsule |
Cylinder | Casts a cylinder |
FromTo | Sets the start and end positions of the trace request |
HitTriggers | Hit Triggers |
HitTriggersOnly | Hit Only Triggers |
IgnoreDynamic | Do not hit dynamic objects |
IgnoreGameObject | Do not hit this object |
IgnoreGameObjectHierarchy | Do not hit this object |
IgnoreKeyframed | Do not hit keyframed objects |
IgnoreStatic | Do not hit static objects |
Radius | Makes this trace a sphere of given radius. |
Ray | Casts a ray from point A to point B. |
Rotated | Makes this a rotated trace, for tracing rotated boxes and capsules. |
Run | Run the trace and return the result. The result will return the first hit. |
RunAll | Run the trace and record everything we hit along the way. The result will be an array of hits. |
Size | Makes this trace an axis aligned box of given size. Extracts mins and maxs from the Bounding Box. |
Sphere | Casts a sphere from point A to point B. |
Sweep | Sweeps each <see cref="T:Sandbox.PhysicsShape">PhysicsShape</see> of given PhysicsBody and returns the closest collision. Does not support Mesh PhysicsShapes. Basically 'hull traces' but with physics shapes. Same as tracing a body but allows rotation to change during the sweep. |
UseHitboxes | Should we hit hitboxes |
UseHitPosition | Should we compute hit position. |
UsePhysicsWorld | Should we hit physics objects? |
UseRenderMeshes | Should we hit meshes too? This can be slow and only really recommended for editor work. |
WithAllTags | Only return entities with all of these tags |
WithAnyTags | Only return entities with any of these tags |
WithCollisionRules | Use the collision rules of an object with the given tags. |
WithoutTags | Only return entities without any of these tags |
WithTag | Only return entities with this tag. Subsequent calls to this will add multiple requirements and they'll all have to be met (ie, the entity will need all tags). |