simvx.core.physics._server¶
PhysicsServer: singleton world manager and internal body record.
Private leaf module: import via the simvx.core.physics facade.
Module Contents¶
Classes¶
Central physics simulation manager. |
Data¶
API¶
- simvx.core.physics._server.log¶
‘getLogger(…)’
- simvx.core.physics._server.__all__¶
[‘PhysicsServer’]
- class simvx.core.physics._server.PhysicsServer(cell_size: float = 2.0)[source]¶
Central physics simulation manager.
Manages all physics bodies, runs broadphase/narrowphase collision detection, resolves contacts with impulse-based response, and provides raycasting.
Usage: server = PhysicsServer.get() server.gravity = Vec3(0, -9.8, 0)
Initialization
- classmethod get() simvx.core.physics._server.PhysicsServer[source]¶
Return the singleton PhysicsServer, creating it if needed.
- property gravity: numpy.ndarray[source]¶
Global gravity vector. Default
(0, -9.8, 0).Accepts a Vec3, tuple, or ndarray when set.
- add_joint(joint) None[source]¶
Register a joint constraint with the server for solving during step().
- step(dt: float) None[source]¶
Advance the physics simulation by dt seconds.
This performs:
Sync positions from nodes
Apply gravity and forces → integrate velocities
Broadphase + narrowphase collision detection
Iterative impulse-based collision response
Integrate positions
Write results back to nodes
Emit body_entered/body_exited signals
- raycast(origin, direction, max_dist: float = 1000.0, layer_mask: int = 4294967295) list[simvx.core.collision.RayHit][source]¶
Cast a ray through the physics world.
Args: origin: Ray start position (Vec3, tuple, or ndarray). direction: Ray direction (will be normalized). max_dist: Maximum ray length. layer_mask: Bitmask to filter bodies by collision layer.
Returns: List of RayHit sorted by distance.