Prowl’s physics system is powered by Jitter2, a high-performance rigid-body simulation library for .NET. The staticDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/ProwlEngine/Prowl/llms.txt
Use this file to discover all available pages before exploring further.
Physics class wraps Jitter2’s World object and exposes it through a Prowl-idiomatic API: raycasting with optional max-distance and layer-mask filtering, a symmetric layer collision matrix for controlling which game-object layers interact, and a PhysicsSetting singleton that is serialised as a project setting. The physics step is advanced each frame by Physics.Update(), which accumulates time and fires fixed-timestep substeps to keep the simulation stable regardless of frame rate.
Physics.World
World instance. Lazily created on first access with a LayerFilter broad-phase filter that checks the layer collision matrix before running narrow-phase tests. Use this property when you need direct Jitter2 API access (e.g., adding constraints, querying contact manifolds).
Physics.Update
- Accumulates
Time.deltaTimeinto an internal timer. - Fires up to 10 fixed-timestep substeps while the timer exceeds
Time.fixedDeltaTime. - Before each step, applies
PhysicsSettingvalues (SolverIterations,RelaxIterations,Substep,AllowSleep,Gravity) to theWorld. - If
PhysicsSetting.UseMultithreadingistrue, Jitter2 parallelises the substep across available CPU cores. - Calls
SceneManager.PhysicsUpdate()each substep so scripts can runFixedUpdatelogic.
Raycasting
All raycast overloads returntrue if the ray hit a collider and false otherwise. The direction parameter is normalised internally before the cast.
Overloads
- Simple hit test
- Hit info
- Max distance
- Max distance + hit info
- Layer mask
- Layer mask + hit info
true if any collider is hit. No hit information is returned.Parameters common to all overloads
World-space start point of the ray.
World-space direction. Normalised internally before casting.
Maximum distance to consider hits. Hits beyond this distance are ignored.
Bit mask of layer indices to include. Only colliders on included layers are tested.
Populated with hit data when the cast returns
true.RaycastHit
RaycastHit is a value type (struct) that carries all information about a single physics ray intersection.
Whether the ray actually intersected something. This is
true when the struct has been filled by a successful cast.Distance from
origin to the impact point (Lambda from Jitter2’s result).World-space position of the impact point, computed as
origin + direction * distance.World-space surface normal at the hit point.
The
Rigidbody3D component attached to the struck object. May be null if the shape has no user data.The specific Jitter2
RigidBodyShape that was hit, useful for sub-mesh or compound-shape identification.The
Transform of the hit rigidbody’s GameObject. Shorthand for rigidbody?.GameObject?.Transform.Layer Collision Matrix
The collision matrix controls which pairs of layers are allowed to generate contacts. It is stored symmetrically — enabling(layer1, layer2) automatically enables (layer2, layer1).
SetLayerCollision
First layer index (0-based).
Second layer index (0-based).
Whether physics contacts should be generated between these layers.
GetLayerCollision
true if the two layers are set to collide.
SetLayerCollisions
GetLayerCollisions
layer as a bool array.
SetAllCollisions
shouldCollide.
EnsureSymmetric
PhysicsSetting.s_collisionMatrix.
PhysicsSetting
PhysicsSetting is a ScriptableSingleton<PhysicsSetting> serialised to PhysicsSettings.projsetting. Access it via PhysicsSetting.Instance.
World gravity vector. Default:
(0, -9.81, 0).Number of velocity constraint solver iterations per substep. Range
[1, 16]. Default: 6.Number of position correction (relaxation) iterations. Range
[0, 16]. Default: 4.Number of Jitter2 substeps per fixed-timestep tick. Range
[1, 16]. Default: 1.Fixed-timestep target in Hz. Determines
Time.fixedDeltaTime = 1.0 / TargetFrameRate. Range [5, 120]. Default: 50.Whether Jitter2 may deactivate sleeping rigid bodies for performance. Default:
true.Whether Jitter2 parallelises the substep across CPU threads. Default:
true.When
true, Rigidbody3D components automatically write simulation results back to Transform after each step.The raw 32×32 symmetric collision matrix. Prefer the
Physics.SetLayerCollision API over direct access.Physics.Clear
World.Clear() to remove all rigid bodies and shapes. Invoked automatically on scene load/unload and playmode transitions.