Class DebugRenderComponentScript
- Namespace
- Stride.CommunityToolkit.Bepu
- Assembly
- Stride.CommunityToolkit.Bepu.dll
Script that ensures a DebugRenderComponent is added to the owning Entity once the scene is ready (when visibility groups are present).
public class DebugRenderComponentScript : SyncScript, IIdentifiable, ICollectorHolder
- Inheritance
-
DebugRenderComponentScript
- Implements
- Inherited Members
- Extension Methods
Remarks
The DebugRenderComponent enables Bepu physics debug rendering. The debug component
itself exposes a Visible property and can be toggled at runtime using the keyboard key
Keys.F11 (see DebugRenderComponent in the Bepu integration).
Important details:
- Adding this script/component to a single entity in the scene will activate the debug mesh
rendering for all Bepu physics entities in that scene (the debug rendering is global per-scene).
- The component in this script is created with
Visible = falseby default to avoid enabling debug rendering unexpectedly. - When a physics body is not awake, its debug mesh is rendered with a lighter color to indicate the sleeping/non-awake state.
Properties
Visible
Gets or sets a value indicating whether the debug mesh is initially true when added.
public bool Visible { get; set; }
Property Value
Methods
Update()
Called once per frame by the engine. When the scene contains one or more visibility groups and the debug component has not yet been added, this method creates and adds a DebugRenderComponent to the Entity.
public override void Update()
Remarks
This method intentionally performs a cheap count check every frame and only performs the
addition once. After the component is added, the component's visibility can be toggled
at runtime by pressing Keys.F11 (handled by DebugRenderComponent).
See the class-level remarks for additional behavior: the debug renderer is global to the
scene, the component is added invisible by default here, and sleeping physics bodies use
a lighter mesh color.