Class PhysicsViewer
Hierarchy
- PhysicsViewer
Index
Constructors
Methods
Constructors
constructor
Creates a new PhysicsViewer
Parameters
Optional scene: Scene
defines the hosting scene
Returns PhysicsViewer
Methods
disposeSearch playground for dispose
Clean up physics debug display
Returns void
hide BodySearch playground for hideBody
Hides a body from the physics engine.
Parameters
body: Nullable<PhysicsBody>
The body to hide.
This function is useful for hiding a body from the physics engine. It removes the body from the utility layer scene and disposes the mesh associated with it. It also unregisters the render function if the number of bodies is 0. This is useful for hiding a body from the physics engine without deleting it.
Returns void
hide ImpostorSearch playground for hideImpostor
Hides an impostor from the scene.
Parameters
impostor: Nullable<PhysicsImpostor>
The impostor to hide.
This method is useful for hiding an impostor from the scene. It removes the impostor from the utility layer scene, disposes the mesh, and removes the impostor from the list of impostors. If the impostor is the last one in the list, it also unregisters the render function.
Returns void
show BodySearch playground for showBody
Shows a debug mesh for a given physics body.
Parameters
body: PhysicsBody
The physics body to show.
Returns Nullable<AbstractMesh>
The debug mesh, or null if the body is already shown.
This function is useful for visualizing the physics body in the scene. It creates a debug mesh for the given body and adds it to the scene. It also registers a before render function to update the debug mesh position and rotation.
show ImpostorSearch playground for showImpostor
Renders a specified physic impostor
Parameters
impostor: PhysicsImpostor
defines the impostor to render
Optional targetMesh: Mesh
defines the mesh represented by the impostor
Returns Nullable<AbstractMesh>
the new debug mesh used to render the impostor
Used to show the physics impostor around the specific mesh