Api Sandbox SceneTrace
struct

SceneTrace

public sealed struct SceneTrace

Methods

SceneTrace Sphere(Single radius, Vector3 from, Vector3 to)

Casts a sphere from point A to point B.

SceneTrace Sphere(Single radius, Ray ray, Single distance)

Casts a sphere from a given position and direction, up to a given distance.

SceneTrace Box(Vector3 extents, Vector3 from, Vector3 to)

Casts a box from point A to point B.

SceneTrace Box(Vector3 extents, Ray ray, Single distance)

Casts a box from a given position and direction, up to a given distance.

SceneTrace Box(BBox bbox, Vector3 from, Vector3 to)

Casts a box from point A to point B.

SceneTrace Box(BBox bbox, Ray ray, Single distance)

Casts a box from a given position and direction, up to a given distance.

SceneTrace Capsule(Capsule capsule)

Casts a capsule

SceneTrace Capsule(Capsule capsule, Vector3 from, Vector3 to)

Casts a capsule from point A to point B.

SceneTrace Capsule(Capsule capsule, Ray ray, Single distance)

Casts a capsule from a given position and direction, up to a given distance.

SceneTrace Cylinder(Single height, Single radius)

Casts a cylinder

SceneTrace Cylinder(Single height, Single radius, Vector3 from, Vector3 to)

Casts a cylinder from point A to point B.

SceneTrace Cylinder(Single height, Single radius, Ray ray, Single distance)

Casts a cylinder from a given position and direction, up to a given distance.

SceneTrace Ray(Vector3 from, Vector3 to)

Casts a ray from point A to point B.

SceneTrace Ray(Ray ray, Single distance)

Casts a ray from a given position and direction, up to a given distance.

SceneTrace Body(PhysicsBody body, Vector3 to)

Casts a PhysicsBody from its current position and rotation to desired end point.

SceneTrace Body(Rigidbody body, Vector3 to)

Casts a PhysicsBody from its current position and rotation to desired end point.

SceneTrace Body(PhysicsBody body, Transform from, Vector3 to)

Casts a PhysicsBody from a position and rotation to desired end point.

SceneTrace Sweep(PhysicsBody body, Transform from, Transform to)

Sweeps each PhysicsShape 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.

SceneTrace Sweep(Rigidbody body, Transform from, Transform to)

Sweeps each PhysicsShape 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.

SceneTrace Sweep(PhysicsBody body, Transform to)

Creates a Trace.Sweep using the PhysicsBody's position as the starting position.

SceneTrace FromTo(Vector3 from, Vector3 to)

Sets the start and end positions of the trace request

SceneTrace FromTo(Transform from, Vector3 to)

Sets the start transform and end position of the trace request

SceneTrace Size(BBox hull)

Makes this trace an axis aligned box of given size. Extracts mins and maxs from the Bounding Box.

SceneTrace Size(Vector3 size)

Makes this trace an axis aligned box of given size. Calculates mins and maxs by assuming given size is (maxs-mins) and the center is in the middle.

SceneTrace Size(Vector3 mins, Vector3 maxs)

Makes this trace an axis aligned box of given size.

SceneTrace Rotated(Rotation rotation)

Makes this a rotated trace, for tracing rotated boxes and capsules.

SceneTrace Radius(Single radius)

Makes this trace a sphere of given radius.

SceneTrace UseHitPosition(Boolean enabled = True)

Should we compute hit position.

SceneTrace UseHitboxes(Boolean hit = True)

Should we hit hitboxes

SceneTrace UseRenderMeshes(Boolean hit = True)

Should we hit meshes too? This can be slow and only works for the editor.

SceneTrace UseRenderMeshes(Boolean hitFront, Boolean hitBack)

Should we hit meshes too? This can be slow and only works for the editor.

SceneTrace UsePhysicsWorld(Boolean hit = True)

Should we hit physics objects?

SceneTrace WithTag(String tag)

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).

SceneTrace WithAllTags(String[] tags)

Only return entities with all of these tags

SceneTrace WithAllTags(ITagSet tags)

Only return entities with all of these tags

SceneTrace WithAnyTags(String[] tags)

Only return entities with any of these tags

SceneTrace WithAnyTags(ITagSet tags)

Only return entities with any of these tags

SceneTrace WithoutTags(String[] tags)

Only return entities without any of these tags

SceneTrace WithoutTags(ITagSet tags)

Only return entities without any of these tags

SceneTrace WithCollisionRules(String tag, Boolean asTrigger = False)

Use the collision rules of an object with the given tags.

tag — Which tag this trace will adopt the collision rules of.
asTrigger — If true, trace against triggers only. Otherwise, trace for collisions (default).
SceneTrace WithCollisionRules(IEnumerable<String> tags, Boolean asTrigger = False)
SceneTrace IgnoreGameObject(GameObject obj)

Do not hit this object

SceneTrace IgnoreGameObjectHierarchy(GameObject obj)

Do not hit this object

SceneTrace HitTriggers()

Hit Triggers

SceneTrace HitTriggersOnly()

Hit Only Triggers

SceneTrace IgnoreStatic()

Do not hit static objects

SceneTrace IgnoreDynamic()

Do not hit dynamic objects

SceneTrace IgnoreKeyframed()

Do not hit keyframed objects

SceneTraceResult Run()

Run the trace and return the result. The result will return the first hit.

IEnumerable<SceneTraceResult> RunAll()

Run the trace and record everything we hit along the way. The result will be an array of hits.

Fields

Name Type Description
PhysicsTrace PhysicsTraceBuilder
Assembly: Sandbox.Engine Namespace: Sandbox Full Name: Sandbox.SceneTrace