Source code for simvx.core.physics
"""SimVX Physics: Rigid body dynamics, collision response, joints.
Pure-Python physics engine using numpy. Integrates with the node lifecycle
via ``on_physics_process(dt)`` and the existing collision shapes from
``simvx.core.collision``.
Usage:
from simvx.core.physics import RigidBody3D, StaticBody3D, PhysicsServer, PhysicsMaterial
from simvx.core.collision import SphereShape, BoxShape
class Ball(RigidBody3D):
mass = Property(2.0)
def on_ready(self):
self.collision_shape = SphereShape(radius=0.5)
self.physics_material = PhysicsMaterial(restitution=0.8)
"""
from ._bodies import (
KinematicBody2D,
KinematicBody3D,
RigidBody2D,
RigidBody3D,
StaticBody2D,
StaticBody3D,
)
from ._joints import (
HingeJoint3D,
Joint2D,
Joint3D,
PinJoint2D,
PinJoint3D,
)
from ._material import BodyMode, Contact, PhysicsMaterial
from ._raycasting import RayCast2D, RayCast3D
from ._server import PhysicsServer
__all__ = [
"PhysicsMaterial",
"BodyMode",
"Contact",
"PhysicsServer",
"RigidBody2D",
"RigidBody3D",
"StaticBody2D",
"StaticBody3D",
"KinematicBody2D",
"KinematicBody3D",
"Joint2D",
"Joint3D",
"PinJoint2D",
"PinJoint3D",
"HingeJoint3D",
"RayCast2D",
"RayCast3D",
]