Class PhysicsWorld
Namespace: ValveResourceFormat.Renderer
Assembly: Renderer.dll
Static collision of one world group: each loaded map's world physics, placed by its spawn group.
public sealed class PhysicsWorldInheritance
object ← PhysicsWorld
Remarks
Queries run in each shape's local space, so a swept box stays aligned to the shape, not the world. Exact for shapes that are only moved, as nearly every spawn group is; approximate when also rotated.
Properties
GroundPlane
Gets or sets the height of an infinite horizontal plane that is solid below, traced on top of the shapes as untagged geometry, or null for none.
public float? GroundPlane { get; set; }Property Value
float?
IsEmpty
Gets whether there is nothing to collide with.
public bool IsEmpty { get; }Property Value
bool
Shapes
Gets the shapes, in their own local spaces.
public IEnumerable<Rubikon> Shapes { get; }Property Value
Methods
Add(Scene, Rubikon, Matrix4x4)
Adds a shape, placed by a rigid transform.
public void Add(Scene owner, Rubikon shape, Matrix4x4 transform)Parameters
owner Scene
The scene of the spawn group the shape belongs to, for PhysicsWorld.Remove(Scene).
shape Rubikon
The collision shape, in its own local space.
transform Matrix4x4
The rigid transform placing it in the world.
Clear()
Removes every shape.
public void Clear()IntersectsAABB(Vector3, Vector3, string)
Tests a box at rest for overlap against the physics shapes it collides with, without sweeping. Unlike Rubikon.TraceAABB(Vector3, Vector3, Vector3, string, bool, bool) this accepts a pure position, so it can answer "am I stuck here" without a probe direction.
public bool IntersectsAABB(Vector3 center, Vector3 halfExtents, string collisionName)Parameters
center Vector3
Center of the box.
halfExtents Vector3
Half-extents of the box.
collisionName string
Collision interaction name used to filter shapes.
Returns
bool
true if any physics triangle overlaps the box.
Remove(Scene)
Removes every shape added for owner.
public void Remove(Scene owner)Parameters
owner Scene
TraceAABB(Vector3, Vector3, Vector3, string, bool, bool)
Sweeps a box given by its half-extents from from to to and returns the closest hit.
public Rubikon.TraceResult TraceAABB(Vector3 from, Vector3 to, Vector3 halfExtents, string collisionName, bool detectStartSolid = false, bool computeContactPoint = false)Parameters
from Vector3
Sweep start position (center of the box).
to Vector3
Sweep end position.
halfExtents Vector3
Half-extents of the swept box.
collisionName string
Collision interaction name used to filter shapes.
detectStartSolid bool
Whether to report overlaps at the start position as start-solid hits.
computeContactPoint bool
Whether hits also compute Rubikon.TraceResult.ContactPoint.
Returns
The closest Rubikon.TraceResult, or an empty result if nothing was hit.
TraceRay(Vector3, Vector3, string)
Traces a ray against all physics shapes and returns the closest hit.
public Rubikon.TraceResult TraceRay(Vector3 from, Vector3 to, string collisionName)Parameters
from Vector3
Ray start position.
to Vector3
Ray end position.
collisionName string
Collision interaction name used to filter shapes.
Returns
The closest Rubikon.TraceResult, or an empty result if nothing was hit.
TraceRay(Vector3, Vector3, string, out Vector3, out Vector3, out float)
Traces a ray, returning the hit as a fraction along the ray.
public bool TraceRay(Vector3 from, Vector3 to, string collisionName, out Vector3 position, out Vector3 normal, out float fraction)Parameters
from Vector3
Start of the ray.
to Vector3
End of the ray.
collisionName string
Collision interaction name used to filter shapes.
position Vector3
The nearest hit point, or to on a miss.
normal Vector3
The surface normal at the hit point, or zero on a miss.
fraction float
Fraction along the ray of the hit, from 0 at the start to 1 at the end. 1 on a miss.
Returns
bool
Whether the ray hit anything.

