Source code for simvx.core.physics

"""SimVX Physics: seam-backed rigid bodies, characters, areas, joints, queries.

The public physics surface is the seam stack: one ``PhysicsBody2D/3D`` node with
a runtime-mutable :class:`BodyMode` (``STATIC | KINEMATIC | DYNAMIC``), swept
``CharacterBody2D/3D`` controllers, ``Area2D/3D`` + ``GravityArea2D/3D`` triggers,
``CollisionShape2D/3D`` carriers fed by :class:`Shape` / :class:`Shape2D`
resources, joints, and the ``self.physics`` / ``self.physics_2d`` spatial-query
wrappers. Bodies resolve their world through a :class:`PhysicsRoot` /
:class:`PhysicsRoot2D` ancestor (or an implicit default world).

Usage:
    from simvx.core import PhysicsBody3D, BodyMode, CollisionShape3D, SphereShape3D

    class Ball(PhysicsBody3D):
        mode = Property(BodyMode.DYNAMIC)

        def on_ready(self):
            self.add_child(CollisionShape3D(shape=SphereShape3D(0.5)))
"""

from .backends import (
    BUILTIN,
    BackendEntry,
    register_backend,
    resolve_backend_name,
    resolve_world_factory,
    resolve_world_factory_2d,
)
from .capability import Capability
from .material import CombineMode, PhysicsMaterial
from .nodes import (
    Area3D,
    CharacterBody3D,
    CollisionShape3D,
    Contact,
    FixedJoint3D,
    GravityArea3D,
    HingeJoint3D,
    Joint3D,
    PhysicsBody3D,
    PinJoint3D,
    SpringJoint3D,
)
from .nodes2d import (
    Area2D,
    CharacterBody2D,
    CollisionShape2D,
    Contact2D,
    FixedJoint2D,
    GravityArea2D,
    GrooveJoint2D,
    HingeJoint2D,
    Joint2D,
    PhysicsBody2D,
    PinJoint2D,
    SpringJoint2D,
)
from .query import PhysicsQuery, RayHit, ShapeHit
from .query2d import PhysicsQuery2D, RayHit2D, ShapeHit2D
from .root import (
    PhysicsRoot,
    PhysicsRoot2D,
    resolve_world,
    resolve_world_2d,
)
from .shapes import (
    BoxShape3D,
    CapsuleShape3D,
    ConcaveMeshShape3D,
    ConvexHullShape3D,
    CylinderShape3D,
    Shape,
    SphereShape3D,
)
from .shapes2d import (
    CapsuleShape2D,
    CircleShape2D,
    ConcavePolygonShape2D,
    ConvexPolygonShape2D,
    RectangleShape2D,
    SegmentShape2D,
    Shape2D,
)
from .world import BodyMode, PhysicsWorld
from .world2d import Physics2DWorld

__all__ = [
    # material
    "BodyMode",
    "CombineMode",
    "PhysicsMaterial",
    "Contact",
    "Contact2D",
    # shapes
    "Shape",
    "SphereShape3D",
    "BoxShape3D",
    "CapsuleShape3D",
    "CylinderShape3D",
    "ConvexHullShape3D",
    "ConcaveMeshShape3D",
    "Shape2D",
    "CircleShape2D",
    "RectangleShape2D",
    "CapsuleShape2D",
    "SegmentShape2D",
    "ConvexPolygonShape2D",
    "ConcavePolygonShape2D",
    # body / character / shape-carrier / area nodes (3D)
    "CollisionShape3D",
    "PhysicsBody3D",
    "CharacterBody3D",
    "Area3D",
    "GravityArea3D",
    # body / character / shape-carrier / area nodes (2D)
    "CollisionShape2D",
    "PhysicsBody2D",
    "CharacterBody2D",
    "Area2D",
    "GravityArea2D",
    # joints (3D)
    "Joint3D",
    "FixedJoint3D",
    "PinJoint3D",
    "HingeJoint3D",
    "SpringJoint3D",
    # joints (2D)
    "Joint2D",
    "FixedJoint2D",
    "PinJoint2D",
    "HingeJoint2D",
    "SpringJoint2D",
    "GrooveJoint2D",
    # query
    "PhysicsQuery",
    "RayHit",
    "ShapeHit",
    "PhysicsQuery2D",
    "RayHit2D",
    "ShapeHit2D",
    # world / root / backends
    "PhysicsWorld",
    "Physics2DWorld",
    "PhysicsRoot",
    "PhysicsRoot2D",
    "resolve_world",
    "resolve_world_2d",
    "Capability",
    "BUILTIN",
    "BackendEntry",
    "register_backend",
    "resolve_backend_name",
    "resolve_world_factory",
    "resolve_world_factory_2d",
]