class PhysicsBridge(val spatial: SpatialInterface)
PhysicsBridge
(
spatial
)
|
spatial
: SpatialInterface
[Get] |
Signature
val spatial: SpatialInterface |
createPhysicsObject
(
entity
, shape
)
|
Creates a physics object for the specified entity with the given shape.
This method adds physics simulation capabilities to an entity, allowing it to participate in the physics world with collisions and dynamics.
Signature
fun createPhysicsObject(entity: Entity, shape: String) Parameters
shape:
String
|
deletePhysics
(
entity
)
|
Removes physics components from the specified entity.
This method should be called when an entity with physics components is being deleted or when physics simulation is no longer needed for that entity.
Signature
fun deletePhysics(entity: Entity) Parameters |
enablePhysicsDebugLines
(
enabled
)
|
Toggles debug lines for visualization of the physics simulation. The color of the lines correspond to the state of the physics objects.
This is useful for debugging physics interactions and understanding how physics bodies are behaving in the scene.
Signature
fun enablePhysicsDebugLines(enabled: Boolean) Parameters
enabled:
Boolean
|
potentiallyActivatePhysicsBodies
()
|
Potentially activates physics bodies that were deactivated due to deleted objects.
When a physics object is deleted, nearby physics bodies may need to be re-enabled to properly respond to the change in the physics world.
Signature
fun potentiallyActivatePhysicsBodies() |
setGravity
(
x
, y
, z
)
|
Sets the gravity vector for the physics simulation.
This method allows customizing the direction and strength of gravity in the physics world, which affects how objects fall and interact.
Signature
fun setGravity(x: Float, y: Float, z: Float) Parameters
x:
Float
y:
Float
z:
Float
|
tickPhysics
()
|
Advances the physics simulation for a single frame.
This method performs collision detection, constraint solving, and integration of physics bodies, updating their positions and orientations.
Signature
fun tickPhysics() |
tickUpdatePhysicsState
()
|
Updates the physics state before simulation.
This method prepares the physics system for simulation by updating the state of all physics bodies based on their associated entities.
Signature
fun tickUpdatePhysicsState() |