"""Type stubs for `rapier._rapier3d` (3D, f32).

Phase 02: math layer only.
"""

from __future__ import annotations

from typing import Any, Iterator, Tuple, Union

import numpy as np

__version__: str

# ---- Exception tree -------------------------------------------------------
class RapierError(Exception): ...
class InvalidHandle(RapierError): ...
class MeshConversionError(RapierError): ...
class UrdfError(RapierError): ...
class MjcfError(RapierError): ...
class SerializationError(RapierError): ...
class QueryFailure(RapierError): ...
class MeshLoaderError(RapierError): ...

# Anything that can be coerced to a 3-vector.
VectorLike = Union[
    "Vec3",
    "Point3",
    Tuple[float, float, float],
    list,
    "np.ndarray",
]
# Anything that can be coerced to a 4-tuple (x, y, z, w) → unit quaternion.
RotationLike = Union[
    "Rotation3",
    Tuple[float, float, float, float],
    list,
    "np.ndarray",
]
IsometryLike = Union["Isometry3", Tuple[VectorLike, RotationLike]]

# ---- Vec3 ----------------------------------------------------------------
class Vec3:
    def __init__(self, x: float, y: float, z: float) -> None: ...
    @staticmethod
    def zeros() -> Vec3: ...
    @staticmethod
    def unit_x() -> Vec3: ...
    @staticmethod
    def unit_y() -> Vec3: ...
    @staticmethod
    def unit_z() -> Vec3: ...
    @staticmethod
    def from_tuple(t: VectorLike) -> Vec3: ...
    @staticmethod
    def from_ndarray(a: np.ndarray) -> Vec3: ...

    x: float
    y: float
    z: float

    def dot(self, other: VectorLike) -> float: ...
    def cross(self, other: VectorLike) -> Vec3: ...
    def norm(self) -> float: ...
    def norm_squared(self) -> float: ...
    def normalize(self) -> Vec3: ...
    def lerp(self, other: VectorLike, t: float) -> Vec3: ...
    def to_tuple(self) -> Tuple[float, float, float]: ...
    def to_ndarray(self) -> np.ndarray: ...
    def bitwise_equal(self, other: Vec3) -> bool: ...

    def __add__(self, other: VectorLike) -> Vec3: ...
    def __sub__(self, other: VectorLike) -> Vec3: ...
    def __mul__(self, scalar: float) -> Vec3: ...
    def __rmul__(self, scalar: float) -> Vec3: ...
    def __truediv__(self, scalar: float) -> Vec3: ...
    def __neg__(self) -> Vec3: ...
    def __len__(self) -> int: ...
    def __getitem__(self, idx: int) -> float: ...
    def __iter__(self) -> Iterator[float]: ...
    def __repr__(self) -> str: ...
    def __eq__(self, other: object) -> bool: ...
    def __ne__(self, other: object) -> bool: ...

# `AngVector3` is a Python-level alias for `Vec3`.
AngVector3 = Vec3

# ---- Point3 --------------------------------------------------------------
class Point3:
    def __init__(self, x: float, y: float, z: float) -> None: ...
    @staticmethod
    def origin() -> Point3: ...
    @staticmethod
    def from_tuple(t: VectorLike) -> Point3: ...
    @staticmethod
    def from_ndarray(a: np.ndarray) -> Point3: ...

    x: float
    y: float
    z: float
    coords: Vec3

    def to_tuple(self) -> Tuple[float, float, float]: ...
    def to_ndarray(self) -> np.ndarray: ...
    def lerp(self, other: VectorLike, t: float) -> Point3: ...
    def bitwise_equal(self, other: Point3) -> bool: ...

    def __add__(self, v: VectorLike) -> Point3: ...
    def __sub__(self, other: Any) -> Union[Point3, Vec3]: ...
    def __len__(self) -> int: ...
    def __getitem__(self, idx: int) -> float: ...
    def __iter__(self) -> Iterator[float]: ...
    def __repr__(self) -> str: ...
    def __eq__(self, other: object) -> bool: ...
    def __ne__(self, other: object) -> bool: ...

# ---- Rotation3 / Quaternion ---------------------------------------------
class Rotation3:
    def __init__(self, w: float = 1.0, x: float = 0.0, y: float = 0.0, z: float = 0.0) -> None: ...
    @staticmethod
    def identity() -> Rotation3: ...
    @staticmethod
    def from_axis_angle(axis: VectorLike, angle: float) -> Rotation3: ...
    @staticmethod
    def from_euler_angles(roll: float, pitch: float, yaw: float) -> Rotation3: ...
    @staticmethod
    def from_scaled_axis(v: VectorLike) -> Rotation3: ...
    @staticmethod
    def from_quaternion(w: float, x: float, y: float, z: float) -> Rotation3: ...
    @staticmethod
    def look_at_lh(dir: VectorLike, up: VectorLike) -> Rotation3: ...
    @staticmethod
    def look_at_rh(dir: VectorLike, up: VectorLike) -> Rotation3: ...
    @staticmethod
    def face_toward(dir: VectorLike, up: VectorLike) -> Rotation3: ...
    @staticmethod
    def from_tuple(t: RotationLike) -> Rotation3: ...
    @staticmethod
    def from_ndarray(a: np.ndarray) -> Rotation3: ...

    axis: Vec3 | None
    angle: float
    scaled_axis: Vec3
    euler_angles: Tuple[float, float, float]
    quaternion: Tuple[float, float, float, float]
    w: float
    i: float
    j: float
    k: float

    def inverse(self) -> Rotation3: ...
    def to_matrix(self) -> np.ndarray: ...
    def transform_point(self, p: VectorLike) -> Point3: ...
    def transform_vector(self, v: VectorLike) -> Vec3: ...
    def slerp(self, other: RotationLike, t: float) -> Rotation3: ...
    def bitwise_equal(self, other: Rotation3) -> bool: ...

    def __mul__(self, rhs: Any) -> Any: ...
    def __repr__(self) -> str: ...
    def __eq__(self, other: object) -> bool: ...
    def __ne__(self, other: object) -> bool: ...

# Alias: `Quaternion is Rotation3`.
Quaternion = Rotation3

# ---- Isometry3 -----------------------------------------------------------
class Isometry3:
    def __init__(
        self,
        translation: VectorLike | None = None,
        rotation: RotationLike | None = None,
    ) -> None: ...
    @staticmethod
    def identity() -> Isometry3: ...
    @staticmethod
    def from_translation(x: float, y: float, z: float) -> Isometry3: ...
    @staticmethod
    def from_rotation(scaled_axis: VectorLike) -> Isometry3: ...
    @staticmethod
    def face_toward(eye: VectorLike, target: VectorLike, up: VectorLike) -> Isometry3: ...
    @staticmethod
    def look_at_lh(eye: VectorLike, target: VectorLike, up: VectorLike) -> Isometry3: ...
    @staticmethod
    def look_at_rh(eye: VectorLike, target: VectorLike, up: VectorLike) -> Isometry3: ...

    @property
    def translation(self) -> Vec3: ...
    @property
    def rotation(self) -> Rotation3: ...

    def inverse(self) -> Isometry3: ...
    def transform_point(self, p: VectorLike) -> Point3: ...
    def transform_vector(self, v: VectorLike) -> Vec3: ...
    def to_matrix(self) -> np.ndarray: ...
    def lerp_slerp(self, other: Isometry3, t: float) -> Isometry3: ...
    def bitwise_equal(self, other: Isometry3) -> bool: ...

    def __mul__(self, rhs: Any) -> Any: ...
    def __repr__(self) -> str: ...
    def __eq__(self, other: object) -> bool: ...
    def __ne__(self, other: object) -> bool: ...

# ---- Free helpers --------------------------------------------------------
def rotation_from_angle(v: VectorLike) -> Rotation3: ...

# =====================================================================
# Phase 03 — Dynamics
# =====================================================================

import enum

class RigidBodyType(enum.IntEnum):
    DYNAMIC: int
    FIXED: int
    KINEMATIC_VELOCITY_BASED: int
    KINEMATIC_POSITION_BASED: int

class CoefficientCombineRule(enum.IntEnum):
    AVERAGE: int
    MIN: int
    MULTIPLY: int
    MAX: int
    CLAMPED_SUM: int

class FrictionModel(enum.IntEnum):
    COEFFICIENT: int
    COULOMB: int

class ColliderHandle:
    def __init__(self, index: int = 0, generation: int = 0) -> None: ...
    @staticmethod
    def from_raw_parts(index: int, generation: int) -> ColliderHandle: ...
    @staticmethod
    def invalid() -> ColliderHandle: ...
    @property
    def index(self) -> int: ...
    @property
    def generation(self) -> int: ...
    def __hash__(self) -> int: ...
    def __eq__(self, other: object) -> bool: ...

class JointEnabled:
    ENABLED: JointEnabled
    DISABLED_BY_ATTACHED_BODY: JointEnabled
    DISABLED: JointEnabled

class MotorModel:
    ACCELERATION_BASED: MotorModel
    FORCE_BASED: MotorModel

class JointLimits:
    min: float
    max: float
    impulse: float
    def __init__(self, min: float = 0.0, max: float = 0.0, impulse: float = 0.0) -> None: ...

class JointMotor:
    target_vel: float
    target_pos: float
    stiffness: float
    damping: float
    max_force: float
    impulse: float
    model: MotorModel
    def __init__(
        self, target_vel: float = 0.0, target_pos: float = 0.0,
        stiffness: float = 0.0, damping: float = 0.0,
        max_force: float = ..., impulse: float = 0.0,
        model: MotorModel = ...,
    ) -> None: ...

class JointAxesMask:
    LIN_X: JointAxesMask
    LIN_Y: JointAxesMask
    ANG_X: JointAxesMask
    LIN_AXES: JointAxesMask
    ANG_AXES: JointAxesMask
    LOCKED_REVOLUTE_AXES: JointAxesMask
    LOCKED_PRISMATIC_AXES: JointAxesMask
    LOCKED_FIXED_AXES: JointAxesMask
    FREE_REVOLUTE_AXES: JointAxesMask
    FREE_PRISMATIC_AXES: JointAxesMask
    FREE_FIXED_AXES: JointAxesMask
    def __init__(self, bits: int = 0) -> None: ...
    @staticmethod
    def empty() -> JointAxesMask: ...
    @staticmethod
    def all_axes() -> JointAxesMask: ...
    @property
    def bits(self) -> int: ...
    def contains(self, other: JointAxesMask) -> bool: ...
    def is_empty(self) -> bool: ...
    def __or__(self, other: JointAxesMask) -> JointAxesMask: ...
    def __and__(self, other: JointAxesMask) -> JointAxesMask: ...
    def __xor__(self, other: JointAxesMask) -> JointAxesMask: ...
    def __invert__(self) -> JointAxesMask: ...
    def __sub__(self, other: JointAxesMask) -> JointAxesMask: ...
    def __contains__(self, other: JointAxesMask) -> bool: ...
    def __bool__(self) -> bool: ...
    def __hash__(self) -> int: ...
    def __eq__(self, other: object) -> bool: ...

class JointAxis:
    LIN_X: JointAxis
    LIN_Y: JointAxis
    LIN_Z: JointAxis
    ANG_X: JointAxis
    ANG_Y: JointAxis
    ANG_Z: JointAxis

class ImpulseJointHandle:
    def __init__(self, index: int = 0, generation: int = 0) -> None: ...
    @staticmethod
    def from_raw_parts(index: int, generation: int) -> ImpulseJointHandle: ...
    @staticmethod
    def invalid() -> ImpulseJointHandle: ...
    @property
    def index(self) -> int: ...
    @property
    def generation(self) -> int: ...
    def __hash__(self) -> int: ...
    def __eq__(self, other: object) -> bool: ...

class MultibodyJointHandle:
    def __init__(self, index: int = 0, generation: int = 0) -> None: ...
    @staticmethod
    def from_raw_parts(index: int, generation: int) -> MultibodyJointHandle: ...
    @staticmethod
    def invalid() -> MultibodyJointHandle: ...
    @property
    def index(self) -> int: ...
    @property
    def generation(self) -> int: ...
    def __hash__(self) -> int: ...
    def __eq__(self, other: object) -> bool: ...

class MultibodyIndex:
    @property
    def index(self) -> int: ...
    @property
    def generation(self) -> int: ...
    def __hash__(self) -> int: ...
    def __eq__(self, other: object) -> bool: ...

class MultibodyLinkId:
    @property
    def multibody(self) -> MultibodyIndex: ...
    @property
    def id(self) -> int: ...

class InverseKinematicsOption:
    damping: float
    max_iters: int
    constrained_axes: JointAxesMask
    epsilon_linear: float
    epsilon_angular: float
    def __init__(
        self, damping: float = 1.0, max_iters: int = 10,
        constrained_axes: JointAxesMask | None = None,
        epsilon_linear: float = 1.0e-3, epsilon_angular: float = 1.0e-3,
    ) -> None: ...

class GenericJoint:
    def __init__(self, locked_axes: JointAxesMask | None = None) -> None: ...
    @staticmethod
    def builder(locked_axes: JointAxesMask | None = None, **kwargs: Any) -> GenericJointBuilder: ...
    contacts_enabled: bool
    locked_axes: JointAxesMask
    coupled_axes: JointAxesMask
    softness: SpringCoefficients
    user_data: int
    @property
    def limit_axes(self) -> JointAxesMask: ...
    @property
    def motor_axes(self) -> JointAxesMask: ...
    @property
    def enabled(self) -> JointEnabled: ...
    def is_enabled(self) -> bool: ...
    def set_enabled(self, b: bool) -> None: ...
    def limits(self, axis: JointAxis) -> JointLimits | None: ...
    def set_limits(self, axis: JointAxis, min: float, max: float) -> None: ...
    def motor(self, axis: JointAxis) -> JointMotor | None: ...
    def motor_model(self, axis: JointAxis) -> MotorModel | None: ...
    def set_motor(self, axis: JointAxis, target_pos: float, target_vel: float, stiffness: float, damping: float) -> None: ...
    def set_motor_velocity(self, axis: JointAxis, target_vel: float, factor: float) -> None: ...
    def set_motor_position(self, axis: JointAxis, target_pos: float, stiffness: float, damping: float) -> None: ...
    def set_motor_max_force(self, axis: JointAxis, max_force: float) -> None: ...
    def set_motor_model(self, axis: JointAxis, model: MotorModel) -> None: ...
    def lock_axes(self, axes: JointAxesMask) -> None: ...

class GenericJointBuilder:
    def __init__(self, locked_axes: JointAxesMask | None = None) -> None: ...
    def local_anchor1(self, p: Any) -> GenericJointBuilder: ...
    def local_anchor2(self, p: Any) -> GenericJointBuilder: ...
    def local_axis1(self, v: Any) -> GenericJointBuilder: ...
    def local_axis2(self, v: Any) -> GenericJointBuilder: ...
    def local_frame1(self, iso: Any) -> GenericJointBuilder: ...
    def local_frame2(self, iso: Any) -> GenericJointBuilder: ...
    def locked_axes(self, m: JointAxesMask) -> GenericJointBuilder: ...
    def coupled_axes(self, m: JointAxesMask) -> GenericJointBuilder: ...
    def contacts_enabled(self, b: bool) -> GenericJointBuilder: ...
    def limits(self, axis: JointAxis, min: float, max: float) -> GenericJointBuilder: ...
    def motor(self, axis: JointAxis, target_pos: float, target_vel: float, stiffness: float, damping: float) -> GenericJointBuilder: ...
    def motor_velocity(self, axis: JointAxis, target_vel: float, factor: float) -> GenericJointBuilder: ...
    def motor_position(self, axis: JointAxis, target_pos: float, stiffness: float, damping: float) -> GenericJointBuilder: ...
    def motor_max_force(self, axis: JointAxis, max_force: float) -> GenericJointBuilder: ...
    def motor_model(self, axis: JointAxis, model: MotorModel) -> GenericJointBuilder: ...
    def user_data(self, d: int) -> GenericJointBuilder: ...
    def softness(self, v: SpringCoefficients) -> GenericJointBuilder: ...
    def build(self) -> GenericJoint: ...

class FixedJoint:
    def __init__(self) -> None: ...
    @staticmethod
    def builder(body_a: Any = None, body_b: Any = None, **kwargs: Any) -> FixedJointBuilder: ...
    contacts_enabled: bool
    local_frame1: Any
    local_frame2: Any
    local_anchor1: Any
    local_anchor2: Any
    @property
    def data(self) -> GenericJoint: ...
    softness: SpringCoefficients

class FixedJointBuilder:
    def __init__(self) -> None: ...
    def local_anchor1(self, p: Any) -> FixedJointBuilder: ...
    def local_anchor2(self, p: Any) -> FixedJointBuilder: ...
    def local_frame1(self, iso: Any) -> FixedJointBuilder: ...
    def local_frame2(self, iso: Any) -> FixedJointBuilder: ...
    def contacts_enabled(self, b: bool) -> FixedJointBuilder: ...
    def softness(self, v: SpringCoefficients) -> FixedJointBuilder: ...
    def build(self) -> FixedJoint: ...

class RevoluteJoint:
    def __init__(self, axis: Any | None = None) -> None: ...
    @staticmethod
    def builder(axis: Any | None = None, **kwargs: Any) -> RevoluteJointBuilder: ...
    @staticmethod
    def new_with_axis(axis: Any) -> RevoluteJoint: ...
    contacts_enabled: bool
    local_anchor1: Any
    local_anchor2: Any
    @property
    def local_axis1(self) -> Any: ...
    @property
    def local_axis2(self) -> Any: ...
    def limits(self) -> JointLimits | None: ...
    def motor(self) -> JointMotor | None: ...
    def set_limits(self, min: float, max: float) -> None: ...
    def set_motor_velocity(self, target_vel: float, factor: float) -> None: ...
    def set_motor_position(self, target_pos: float, stiffness: float, damping: float) -> None: ...
    def set_motor(self, target_pos: float, target_vel: float, stiffness: float, damping: float) -> None: ...
    def set_motor_max_force(self, max_force: float) -> None: ...
    def set_motor_model(self, model: MotorModel) -> None: ...
    @property
    def data(self) -> GenericJoint: ...
    softness: SpringCoefficients
    def angle(self, body_rotation1: Any, body_rotation2: Any) -> float: ...

class RevoluteJointBuilder:
    def __init__(self, axis: Any | None = None) -> None: ...
    def local_anchor1(self, p: Any) -> RevoluteJointBuilder: ...
    def local_anchor2(self, p: Any) -> RevoluteJointBuilder: ...
    def local_axis1(self, v: Any) -> RevoluteJointBuilder: ...
    def local_axis2(self, v: Any) -> RevoluteJointBuilder: ...
    def limits(self, min: float, max: float) -> RevoluteJointBuilder: ...
    def contacts_enabled(self, b: bool) -> RevoluteJointBuilder: ...
    def motor_velocity(self, target_vel: float, factor: float) -> RevoluteJointBuilder: ...
    def motor_position(self, target_pos: float, stiffness: float, damping: float) -> RevoluteJointBuilder: ...
    def motor(self, target_pos: float, target_vel: float, stiffness: float, damping: float) -> RevoluteJointBuilder: ...
    def motor_max_force(self, max_force: float) -> RevoluteJointBuilder: ...
    def motor_model(self, model: MotorModel) -> RevoluteJointBuilder: ...
    def softness(self, v: SpringCoefficients) -> RevoluteJointBuilder: ...
    def build(self) -> RevoluteJoint: ...

class PrismaticJoint:
    def __init__(self, axis: Any) -> None: ...
    @staticmethod
    def builder(axis: Any, **kwargs: Any) -> PrismaticJointBuilder: ...
    contacts_enabled: bool
    local_anchor1: Any
    local_anchor2: Any
    local_axis1: Any
    local_axis2: Any
    def limits(self) -> JointLimits | None: ...
    def motor(self) -> JointMotor | None: ...
    def set_limits(self, min: float, max: float) -> None: ...
    def set_motor_velocity(self, target_vel: float, factor: float) -> None: ...
    def set_motor_position(self, target_pos: float, stiffness: float, damping: float) -> None: ...
    def set_motor(self, target_pos: float, target_vel: float, stiffness: float, damping: float) -> None: ...
    def set_motor_max_force(self, max_force: float) -> None: ...
    def set_motor_model(self, model: MotorModel) -> None: ...
    @property
    def data(self) -> GenericJoint: ...
    softness: SpringCoefficients

class PrismaticJointBuilder:
    def __init__(self, axis: Any) -> None: ...
    def local_anchor1(self, p: Any) -> PrismaticJointBuilder: ...
    def local_anchor2(self, p: Any) -> PrismaticJointBuilder: ...
    def local_axis1(self, v: Any) -> PrismaticJointBuilder: ...
    def local_axis2(self, v: Any) -> PrismaticJointBuilder: ...
    def limits(self, min: float, max: float) -> PrismaticJointBuilder: ...
    def contacts_enabled(self, b: bool) -> PrismaticJointBuilder: ...
    def motor_velocity(self, target_vel: float, factor: float) -> PrismaticJointBuilder: ...
    def motor_position(self, target_pos: float, stiffness: float, damping: float) -> PrismaticJointBuilder: ...
    def motor_max_force(self, max_force: float) -> PrismaticJointBuilder: ...
    def motor_model(self, model: MotorModel) -> PrismaticJointBuilder: ...
    def softness(self, v: SpringCoefficients) -> PrismaticJointBuilder: ...
    def build(self) -> PrismaticJoint: ...

class SphericalJoint:
    def __init__(self) -> None: ...
    @staticmethod
    def builder(body_a: Any = None, body_b: Any = None, **kwargs: Any) -> SphericalJointBuilder: ...
    contacts_enabled: bool
    local_anchor1: Any
    local_anchor2: Any
    local_frame1: Any
    local_frame2: Any
    def motor(self, axis: JointAxis) -> JointMotor | None: ...
    def limits(self, axis: JointAxis) -> JointLimits | None: ...
    def set_limits(self, axis: JointAxis, min: float, max: float) -> None: ...
    def set_motor_velocity(self, axis: JointAxis, target_vel: float, factor: float) -> None: ...
    def set_motor_position(self, axis: JointAxis, target_pos: float, stiffness: float, damping: float) -> None: ...
    def set_motor(self, axis: JointAxis, target_pos: float, target_vel: float, stiffness: float, damping: float) -> None: ...
    def set_motor_max_force(self, axis: JointAxis, max_force: float) -> None: ...
    def set_motor_model(self, axis: JointAxis, model: MotorModel) -> None: ...
    @property
    def data(self) -> GenericJoint: ...
    softness: SpringCoefficients

class SphericalJointBuilder:
    def __init__(self) -> None: ...
    def local_anchor1(self, p: Any) -> SphericalJointBuilder: ...
    def local_anchor2(self, p: Any) -> SphericalJointBuilder: ...
    def local_frame1(self, iso: Any) -> SphericalJointBuilder: ...
    def local_frame2(self, iso: Any) -> SphericalJointBuilder: ...
    def contacts_enabled(self, b: bool) -> SphericalJointBuilder: ...
    def motor_velocity(self, axis: JointAxis, target_vel: float, factor: float) -> SphericalJointBuilder: ...
    def motor_position(self, axis: JointAxis, target_pos: float, stiffness: float, damping: float) -> SphericalJointBuilder: ...
    def motor(self, axis: JointAxis, target_pos: float, target_vel: float, stiffness: float, damping: float) -> SphericalJointBuilder: ...
    def motor_max_force(self, axis: JointAxis, max_force: float) -> SphericalJointBuilder: ...
    def motor_model(self, axis: JointAxis, model: MotorModel) -> SphericalJointBuilder: ...
    def limits(self, axis: JointAxis, min: float, max: float) -> SphericalJointBuilder: ...
    def softness(self, v: SpringCoefficients) -> SphericalJointBuilder: ...
    def build(self) -> SphericalJoint: ...

class RopeJoint:
    def __init__(self, max_distance: float = 1.0) -> None: ...
    @staticmethod
    def builder(max_distance: float, **kwargs: Any) -> RopeJointBuilder: ...
    contacts_enabled: bool
    max_distance: float
    local_anchor1: Any
    local_anchor2: Any
    @property
    def min_distance(self) -> float: ...
    @property
    def data(self) -> GenericJoint: ...
    softness: SpringCoefficients

class RopeJointBuilder:
    def __init__(self, max_distance: float = 1.0) -> None: ...
    def local_anchor1(self, p: Any) -> RopeJointBuilder: ...
    def local_anchor2(self, p: Any) -> RopeJointBuilder: ...
    def max_distance(self, d: float) -> RopeJointBuilder: ...
    def contacts_enabled(self, b: bool) -> RopeJointBuilder: ...
    def softness(self, v: SpringCoefficients) -> RopeJointBuilder: ...
    def build(self) -> RopeJoint: ...

class SpringJoint:
    def __init__(self, rest_length: float = 0.0, stiffness: float = 1.0, damping: float = 0.0) -> None: ...
    @staticmethod
    def builder(rest_length: float, stiffness: float, damping: float, **kwargs: Any) -> SpringJointBuilder: ...
    contacts_enabled: bool
    local_anchor1: Any
    local_anchor2: Any
    @property
    def rest_length(self) -> float: ...
    @property
    def spring_stiffness(self) -> float: ...
    @property
    def spring_damping(self) -> float: ...
    @property
    def model(self) -> MotorModel: ...
    def set_spring_model(self, model: MotorModel) -> None: ...
    @property
    def data(self) -> GenericJoint: ...

class SpringJointBuilder:
    def __init__(self, rest_length: float = 0.0, stiffness: float = 1.0, damping: float = 0.0) -> None: ...
    def local_anchor1(self, p: Any) -> SpringJointBuilder: ...
    def local_anchor2(self, p: Any) -> SpringJointBuilder: ...
    def contacts_enabled(self, b: bool) -> SpringJointBuilder: ...
    def spring_model(self, m: MotorModel) -> SpringJointBuilder: ...
    def build(self) -> SpringJoint: ...

class ImpulseJoint:
    @property
    def body1(self) -> RigidBodyHandle: ...
    @property
    def body2(self) -> RigidBodyHandle: ...
    @property
    def data(self) -> GenericJoint: ...
    @property
    def impulses(self) -> list[float]: ...

class ImpulseJointSet:
    def __init__(self) -> None: ...
    def insert(self, body1: RigidBodyHandle, body2: RigidBodyHandle, joint: Any, wake_up: bool = True) -> ImpulseJointHandle: ...
    def remove(self, handle: ImpulseJointHandle, wake_up: bool = True) -> ImpulseJoint | None: ...
    def get(self, handle: ImpulseJointHandle) -> ImpulseJoint | None: ...
    def attached_joints(self, body: RigidBodyHandle) -> Any: ...
    def bodies_connected_by_joint(self, handle: ImpulseJointHandle) -> tuple[RigidBodyHandle, RigidBodyHandle]: ...
    def clear(self) -> None: ...
    def __len__(self) -> int: ...
    def __getitem__(self, handle: ImpulseJointHandle) -> ImpulseJoint: ...
    def __contains__(self, handle: ImpulseJointHandle) -> bool: ...
    def __iter__(self) -> Any: ...

class MultibodyLink:
    @property
    def rigid_body(self) -> RigidBodyHandle: ...
    @property
    def link_id(self) -> int: ...
    @property
    def parent_id(self) -> int | None: ...
    def is_root(self) -> bool: ...

class Multibody:
    @property
    def root_handle(self) -> RigidBodyHandle: ...
    @property
    def num_links(self) -> int: ...
    @property
    def ndofs(self) -> int: ...
    def get_link(self, idx: int) -> MultibodyLink | None: ...
    def __iter__(self) -> Any: ...
    def self_contacts_enabled(self) -> bool: ...
    def set_self_contacts_enabled(self, v: bool) -> None: ...
    def damping(self) -> list[float]: ...
    def set_damping(self, values: list[float]) -> None: ...
    def generalized_velocity(self) -> list[float]: ...
    def set_generalized_velocity(self, values: list[float]) -> None: ...
    def generalized_acceleration(self) -> list[float]: ...
    def joint_velocity(self, link: MultibodyLink) -> list[float]: ...
    def body_jacobian(self, link_id: int) -> list[list[float]]: ...
    def kinematic_branch(self, link_id: int) -> list[int]: ...
    def update_rigid_bodies(self, bodies: RigidBodySet, update_mass_properties: bool) -> None: ...
    def forward_kinematics(self, bodies: RigidBodySet, read_root_pose_from_rigid_body: bool = False) -> None: ...

class MultibodyJointSet:
    def __init__(self) -> None: ...
    def insert(self, parent: RigidBodyHandle, link_body: RigidBodyHandle, joint: Any, wake_up: bool = True) -> MultibodyJointHandle | None: ...
    def insert_kinematic(self, parent: RigidBodyHandle, link_body: RigidBodyHandle, joint: Any, wake_up: bool = True) -> MultibodyJointHandle | None: ...
    def remove(self, handle: MultibodyJointHandle, wake_up: bool = True) -> None: ...
    def get(self, handle: MultibodyJointHandle) -> tuple[Multibody, int] | None: ...
    def multibody(self, handle: MultibodyJointHandle) -> Multibody | None: ...
    def rigid_body_link(self, body: RigidBodyHandle) -> MultibodyLinkId | None: ...
    def get_multibody(self, index: MultibodyIndex) -> Multibody | None: ...
    def joint_between(
        self, body1: RigidBodyHandle, body2: RigidBodyHandle
    ) -> tuple[MultibodyJointHandle, Multibody, MultibodyLink] | None: ...
    def attached_joints(self, body: RigidBodyHandle) -> Any: ...
    def inverse_kinematics_for_link(
        self, bodies: Any, handle: MultibodyJointHandle,
        target_pose: Any, option: InverseKinematicsOption | None = None,
    ) -> list[float]: ...
    def __len__(self) -> int: ...
    def __iter__(self) -> Any: ...

class RigidBodyHandle:
    def __init__(self, index: int = 0, generation: int = 0) -> None: ...
    @staticmethod
    def from_raw_parts(index: int, generation: int) -> RigidBodyHandle: ...
    @staticmethod
    def invalid() -> RigidBodyHandle: ...
    @property
    def index(self) -> int: ...
    @property
    def generation(self) -> int: ...
    def __hash__(self) -> int: ...
    def __eq__(self, other: object) -> bool: ...

class LockedAxes:
    TRANSLATION_LOCKED_X: LockedAxes
    TRANSLATION_LOCKED_Y: LockedAxes
    TRANSLATION_LOCKED_Z: LockedAxes
    TRANSLATION_LOCKED: LockedAxes
    ROTATION_LOCKED_X: LockedAxes
    ROTATION_LOCKED_Y: LockedAxes
    ROTATION_LOCKED_Z: LockedAxes
    ROTATION_LOCKED: LockedAxes
    ALL: LockedAxes
    def __init__(self, bits: int = 0) -> None: ...
    @staticmethod
    def empty() -> LockedAxes: ...
    @staticmethod
    def all_axes() -> LockedAxes: ...
    @property
    def bits(self) -> int: ...
    def contains(self, other: LockedAxes) -> bool: ...
    def is_empty(self) -> bool: ...
    def __or__(self, other: LockedAxes) -> LockedAxes: ...
    def __and__(self, other: LockedAxes) -> LockedAxes: ...
    def __xor__(self, other: LockedAxes) -> LockedAxes: ...
    def __invert__(self) -> LockedAxes: ...

class RigidBodyActivation:
    sleep_threshold: float
    linear_threshold: float
    angular_threshold: float
    time_until_sleep: float
    sleeping: bool
    def __init__(self) -> None: ...
    @staticmethod
    def active() -> RigidBodyActivation: ...
    @staticmethod
    def inactive() -> RigidBodyActivation: ...
    @staticmethod
    def cannot_sleep() -> RigidBodyActivation: ...
    def is_active(self) -> bool: ...

class SpringCoefficients:
    stiffness: float
    damping: float
    natural_frequency: float
    damping_ratio: float
    def __init__(self, stiffness: float = 30.0, damping: float = 5.0) -> None: ...
    @staticmethod
    def contact_defaults() -> SpringCoefficients: ...
    @staticmethod
    def joint_defaults() -> SpringCoefficients: ...

class MassProperties:
    def __init__(
        self,
        local_com: VectorLike | None = None,
        mass: float = 0.0,
        principal_inertia: VectorLike | None = None,
        principal_inertia_local_frame: RotationLike | None = None,
    ) -> None: ...
    @staticmethod
    def zero() -> MassProperties: ...
    @staticmethod
    def from_ball(density: float, radius: float) -> MassProperties: ...
    @staticmethod
    def from_cuboid(density: float, half_extents: VectorLike) -> MassProperties: ...
    @staticmethod
    def from_capsule(density: float, a: VectorLike, b: VectorLike, radius: float) -> MassProperties: ...
    @staticmethod
    def from_cylinder(density: float, half_height: float, radius: float) -> MassProperties: ...
    @staticmethod
    def from_cone(density: float, half_height: float, radius: float) -> MassProperties: ...
    @property
    def mass(self) -> float: ...
    @property
    def inv_mass(self) -> float: ...
    @property
    def local_com(self) -> Point3: ...
    @property
    def principal_inertia(self) -> Vec3: ...
    @property
    def principal_inertia_local_frame(self) -> Rotation3: ...
    def transform_by(self, iso: IsometryLike) -> MassProperties: ...
    def __add__(self, other: MassProperties) -> MassProperties: ...
    def __sub__(self, other: MassProperties) -> MassProperties: ...

class RigidBodyAdditionalMassProps:
    @staticmethod
    def from_mass(mass: float) -> RigidBodyAdditionalMassProps: ...
    @staticmethod
    def from_mass_properties(mp: MassProperties) -> RigidBodyAdditionalMassProps: ...

class RigidBodyDamping:
    linear_damping: float
    angular_damping: float
    def __init__(self, linear_damping: float = 0.0, angular_damping: float = 0.0) -> None: ...

class RigidBodyDominance:
    group: int
    def __init__(self, group: int = 0) -> None: ...

class RigidBodyCcd:
    ccd_enabled: bool
    soft_ccd_prediction: float
    def __init__(self, ccd_enabled: bool = False, soft_ccd_prediction: float = 0.0) -> None: ...

class RigidBodyVelocity:
    linvel: Vec3
    angvel: Vec3
    def __init__(self, linvel: VectorLike | None = None, angvel: VectorLike | None = None) -> None: ...

class RigidBodyForces:
    force: Vec3
    torque: Vec3
    gravity_scale: float

class RigidBodyMassProps:
    local_mprops: MassProperties

class RigidBodyPosition:
    position: Isometry3
    next_position: Isometry3

class IntegrationParameters:
    dt: float
    min_ccd_dt: float
    warmstart_coefficient: float
    length_unit: float
    normalized_allowed_linear_error: float
    normalized_max_corrective_velocity: float
    normalized_prediction_distance: float
    num_solver_iterations: int
    num_internal_pgs_iterations: int
    num_internal_stabilization_iterations: int
    contact_clustering: bool
    contact_recycling: bool
    normalized_contact_recycle_distance: float
    normalized_max_linear_velocity: float
    max_ccd_substeps: int
    contact_softness: SpringCoefficients
    static_contact_softness: SpringCoefficients
    friction_model: FrictionModel
    def __init__(self) -> None: ...
    @staticmethod
    def default_params() -> IntegrationParameters: ...
    def inv_dt(self) -> float: ...
    def allowed_linear_error(self) -> float: ...
    def max_corrective_velocity(self) -> float: ...
    def prediction_distance(self) -> float: ...
    def contact_spring_stiffness(self) -> float: ...
    def contact_spring_damping(self) -> float: ...
    def joint_spring_stiffness(self) -> float: ...
    def joint_spring_damping(self) -> float: ...

class IslandManager:
    def __init__(self) -> None: ...
    def __len__(self) -> int: ...
    def __iter__(self) -> Iterator[RigidBodyHandle]: ...
    def active_dynamic_set(self) -> list[RigidBodyHandle]: ...
    def contains_handle(self, h: RigidBodyHandle) -> bool: ...
    def same_island(self, h1: RigidBodyHandle, h2: RigidBodyHandle) -> bool: ...
    def active_set_offset(self, h: RigidBodyHandle) -> int: ...

class CCDSolver:
    def __init__(self) -> None: ...
    def clear(self) -> None: ...
    def solve_ccd(self, *args: Any, **kwargs: Any) -> None: ...

class RigidBodyBuilder:
    def __init__(self, body_type: RigidBodyType = ...) -> None: ...
    def translation(self, v: VectorLike) -> RigidBodyBuilder: ...
    def rotation(self, scaled_axis: VectorLike) -> RigidBodyBuilder: ...
    def position(self, p: IsometryLike) -> RigidBodyBuilder: ...
    def linvel(self, v: VectorLike) -> RigidBodyBuilder: ...
    def angvel(self, v: VectorLike) -> RigidBodyBuilder: ...
    def linear_damping(self, f: float) -> RigidBodyBuilder: ...
    def angular_damping(self, f: float) -> RigidBodyBuilder: ...
    def gravity_scale(self, f: float) -> RigidBodyBuilder: ...
    def can_sleep(self, b: bool) -> RigidBodyBuilder: ...
    def sleeping(self, b: bool) -> RigidBodyBuilder: ...
    def ccd_enabled(self, b: bool) -> RigidBodyBuilder: ...
    def soft_ccd_prediction(self, f: float) -> RigidBodyBuilder: ...
    def dominance_group(self, g: int) -> RigidBodyBuilder: ...
    def additional_solver_iterations(self, n: int) -> RigidBodyBuilder: ...
    def user_data(self, d: int) -> RigidBodyBuilder: ...
    def enabled(self, b: bool) -> RigidBodyBuilder: ...
    def additional_mass(self, m: float) -> RigidBodyBuilder: ...
    def additional_mass_properties(self, mp: MassProperties) -> RigidBodyBuilder: ...
    def locked_axes(self, la: LockedAxes) -> RigidBodyBuilder: ...
    def enabled_translations(self, t: tuple[bool, bool, bool]) -> RigidBodyBuilder: ...
    def restrict_translations(self, t: tuple[bool, bool, bool]) -> RigidBodyBuilder: ...
    def enabled_rotations(self, t: tuple[bool, bool, bool]) -> RigidBodyBuilder: ...
    def restrict_rotations(self, t: tuple[bool, bool, bool]) -> RigidBodyBuilder: ...
    def gyroscopic_forces(self, b: bool) -> RigidBodyBuilder: ...
    def build(self) -> RigidBody: ...

class RigidBody:
    position: Isometry3
    translation: Vec3
    rotation: Rotation3
    linvel: Vec3
    angvel: Vec3
    user_data: int
    body_type: RigidBodyType
    gravity_scale: float
    linear_damping: float
    angular_damping: float
    dominance_group: int
    additional_solver_iterations: int
    locked_axes: LockedAxes
    enabled_translations: tuple[bool, bool, bool]
    enabled_rotations: tuple[bool, bool, bool]
    is_enabled: bool
    ccd_enabled: bool
    soft_ccd_prediction: float
    gyroscopic_forces_enabled: bool
    activation: RigidBodyActivation
    @property
    def mass(self) -> float: ...
    @property
    def inv_mass(self) -> float: ...
    @property
    def center_of_mass(self) -> Point3: ...
    @property
    def local_center_of_mass(self) -> Point3: ...
    @property
    def mass_properties(self) -> MassProperties: ...
    @property
    def is_sleeping(self) -> bool: ...
    @property
    def is_moving(self) -> bool: ...
    @property
    def is_dynamic(self) -> bool: ...
    @property
    def is_kinematic(self) -> bool: ...
    @property
    def is_fixed(self) -> bool: ...
    @property
    def user_force(self) -> Vec3: ...
    @property
    def user_torque(self) -> Vec3: ...
    @property
    def colliders(self) -> list[ColliderHandle]: ...
    @property
    def next_position(self) -> Isometry3: ...
    @staticmethod
    def dynamic(**kwargs: Any) -> RigidBodyBuilder: ...
    @staticmethod
    def fixed(**kwargs: Any) -> RigidBodyBuilder: ...
    @staticmethod
    def kinematic_velocity_based(**kwargs: Any) -> RigidBodyBuilder: ...
    @staticmethod
    def kinematic_position_based(**kwargs: Any) -> RigidBodyBuilder: ...
    @staticmethod
    def new_body(body_type: RigidBodyType, **kwargs: Any) -> RigidBodyBuilder: ...
    def add_force(self, force: VectorLike, wake_up: bool = True) -> None: ...
    def add_torque(self, torque: VectorLike, wake_up: bool = True) -> None: ...
    def add_force_at_point(self, force: VectorLike, point: VectorLike, wake_up: bool = True) -> None: ...
    def apply_impulse(self, impulse: VectorLike, wake_up: bool = True) -> None: ...
    def apply_torque_impulse(self, torque_impulse: VectorLike, wake_up: bool = True) -> None: ...
    def apply_impulse_at_point(self, impulse: VectorLike, point: VectorLike, wake_up: bool = True) -> None: ...
    def add_gravitational_force(self, gravity: VectorLike) -> None: ...
    def reset_forces(self, wake_up: bool = True) -> None: ...
    def reset_torques(self, wake_up: bool = True) -> None: ...
    def wake_up(self, strong: bool = True) -> None: ...
    def sleep(self) -> None: ...
    def velocity_at_point(self, point: VectorLike) -> Vec3: ...
    def kinetic_energy(self) -> float: ...
    def gravitational_potential_energy(self, dt: float, gravity: VectorLike) -> float: ...
    def predict_position_using_velocity(self, dt: float) -> Isometry3: ...
    def predict_position_using_velocity_and_forces(self, dt: float) -> Isometry3: ...
    def angvel_with_gyroscopic_forces(self, dt: float) -> Vec3: ...
    def recompute_mass_properties_from_colliders(self, colliders: ColliderSet) -> None: ...
    def set_additional_mass(self, mass: float, wake_up: bool = True) -> None: ...
    def set_additional_mass_properties(self, mp: MassProperties, wake_up: bool = True) -> None: ...

class RigidBodySet:
    def __init__(self) -> None: ...
    def insert(self, body: RigidBody | RigidBodyBuilder) -> RigidBodyHandle: ...
    def remove(
        self,
        handle: RigidBodyHandle,
        islands: IslandManager,
        colliders: ColliderSet,
        impulse_joints: ImpulseJointSet,
        multibody_joints: MultibodyJointSet,
        remove_attached_colliders: bool = True,
    ) -> RigidBody | None: ...
    def get(self, handle: RigidBodyHandle) -> RigidBody | None: ...
    def clear(self) -> None: ...
    def handles(self) -> Iterator[RigidBodyHandle]: ...
    def __getitem__(self, handle: RigidBodyHandle) -> RigidBody: ...
    def __contains__(self, handle: RigidBodyHandle) -> bool: ...
    def __iter__(self) -> Iterator[Tuple[RigidBodyHandle, RigidBody]]: ...
    def __len__(self) -> int: ...

# ===========================================================================
# Phase 04 — Geometry, Shapes, Broad/Narrow Phase
# ===========================================================================

class ShapeType:
    BALL: ShapeType
    CUBOID: ShapeType
    CAPSULE: ShapeType
    SEGMENT: ShapeType
    TRIANGLE: ShapeType
    VOXELS: ShapeType
    TRIMESH: ShapeType
    POLYLINE: ShapeType
    HALFSPACE: ShapeType
    HEIGHTFIELD: ShapeType
    COMPOUND: ShapeType
    CONVEX_POLYGON: ShapeType
    CONVEX_POLYHEDRON: ShapeType
    CYLINDER: ShapeType
    CONE: ShapeType
    ROUND_CUBOID: ShapeType
    ROUND_TRIANGLE: ShapeType
    ROUND_CYLINDER: ShapeType
    ROUND_CONE: ShapeType
    ROUND_CONVEX_POLYHEDRON: ShapeType
    ROUND_CONVEX_POLYGON: ShapeType
    CUSTOM: ShapeType

class ColliderType:
    SOLID: ColliderType
    SENSOR: ColliderType

class ColliderEnabled:
    ENABLED: ColliderEnabled
    DISABLED_BY_PARENT: ColliderEnabled
    DISABLED: ColliderEnabled

class ActiveEvents:
    COLLISION_EVENTS: ActiveEvents
    CONTACT_FORCE_EVENTS: ActiveEvents
    NONE: ActiveEvents
    def __init__(self, bits: int = 0) -> None: ...
    @staticmethod
    def empty() -> ActiveEvents: ...
    @staticmethod
    def all_events() -> ActiveEvents: ...
    @property
    def bits(self) -> int: ...
    def contains(self, other: ActiveEvents) -> bool: ...
    def is_empty(self) -> bool: ...
    def __or__(self, other: ActiveEvents) -> ActiveEvents: ...
    def __and__(self, other: ActiveEvents) -> ActiveEvents: ...
    def __xor__(self, other: ActiveEvents) -> ActiveEvents: ...
    def __invert__(self) -> ActiveEvents: ...
    def __sub__(self, other: ActiveEvents) -> ActiveEvents: ...

class ActiveHooks:
    FILTER_CONTACT_PAIR: ActiveHooks
    FILTER_CONTACT_PAIRS: ActiveHooks
    FILTER_INTERSECTION_PAIR: ActiveHooks
    MODIFY_SOLVER_CONTACTS: ActiveHooks
    NONE: ActiveHooks
    def __init__(self, bits: int = 0) -> None: ...
    @staticmethod
    def empty() -> ActiveHooks: ...
    @staticmethod
    def all_hooks() -> ActiveHooks: ...
    @property
    def bits(self) -> int: ...
    def contains(self, other: ActiveHooks) -> bool: ...
    def __or__(self, other: ActiveHooks) -> ActiveHooks: ...
    def __and__(self, other: ActiveHooks) -> ActiveHooks: ...


class ActiveCollisionTypes:
    DYNAMIC_DYNAMIC: ActiveCollisionTypes
    DYNAMIC_KINEMATIC: ActiveCollisionTypes
    DYNAMIC_FIXED: ActiveCollisionTypes
    KINEMATIC_KINEMATIC: ActiveCollisionTypes
    KINEMATIC_FIXED: ActiveCollisionTypes
    FIXED_FIXED: ActiveCollisionTypes
    NONE: ActiveCollisionTypes
    def __init__(self, bits: int = 0) -> None: ...
    @staticmethod
    def empty() -> ActiveCollisionTypes: ...
    @staticmethod
    def all() -> ActiveCollisionTypes: ...
    @staticmethod
    def default_types() -> ActiveCollisionTypes: ...
    @property
    def bits(self) -> int: ...
    def contains(self, other: ActiveCollisionTypes) -> bool: ...
    def is_empty(self) -> bool: ...
    def __or__(self, other: ActiveCollisionTypes) -> ActiveCollisionTypes: ...
    def __and__(self, other: ActiveCollisionTypes) -> ActiveCollisionTypes: ...
    def __xor__(self, other: ActiveCollisionTypes) -> ActiveCollisionTypes: ...
    def __invert__(self) -> ActiveCollisionTypes: ...
    def __sub__(self, other: ActiveCollisionTypes) -> ActiveCollisionTypes: ...
    def __contains__(self, other: ActiveCollisionTypes) -> bool: ...

class Group:
    GROUP_0: Group
    GROUP_1: Group
    GROUP_2: Group
    GROUP_3: Group
    GROUP_4: Group
    GROUP_5: Group
    GROUP_6: Group
    GROUP_7: Group
    GROUP_8: Group
    GROUP_9: Group
    GROUP_10: Group
    GROUP_11: Group
    GROUP_12: Group
    GROUP_13: Group
    GROUP_14: Group
    GROUP_15: Group
    GROUP_16: Group
    GROUP_17: Group
    GROUP_18: Group
    GROUP_19: Group
    GROUP_20: Group
    GROUP_21: Group
    GROUP_22: Group
    GROUP_23: Group
    GROUP_24: Group
    GROUP_25: Group
    GROUP_26: Group
    GROUP_27: Group
    GROUP_28: Group
    GROUP_29: Group
    GROUP_30: Group
    GROUP_31: Group
    ALL: Group
    NONE: Group
    def __init__(self, bits: int = 0) -> None: ...
    @staticmethod
    def from_bits(bits: int) -> Group: ...
    @property
    def bits(self) -> int: ...
    def contains(self, other: Group) -> bool: ...
    def __or__(self, other: Group) -> Group: ...
    def __and__(self, other: Group) -> Group: ...
    def __xor__(self, other: Group) -> Group: ...
    def __invert__(self) -> Group: ...

class InteractionTestMode:
    DEFAULT: InteractionTestMode
    ONLY_DYNAMIC: InteractionTestMode
    AND: InteractionTestMode
    OR: InteractionTestMode

class InteractionGroups:
    memberships: Group
    filter: Group
    test_mode: InteractionTestMode
    def __init__(
        self,
        memberships: Group | None = None,
        filter: Group | None = None,
        test_mode: InteractionTestMode | None = None,
    ) -> None: ...
    @staticmethod
    def all() -> InteractionGroups: ...
    @staticmethod
    def none() -> InteractionGroups: ...
    def with_membership(self, g: Group) -> InteractionGroups: ...
    def with_memberships(self, g: Group) -> InteractionGroups: ...
    def with_filter(self, g: Group) -> InteractionGroups: ...
    def test(self, other: InteractionGroups) -> bool: ...

class CollisionEventFlags:
    SENSOR: CollisionEventFlags
    REMOVED: CollisionEventFlags
    def __init__(self, bits: int = 0) -> None: ...
    @staticmethod
    def empty() -> CollisionEventFlags: ...
    def contains(self, other: CollisionEventFlags) -> bool: ...

class TriMeshFlags:
    HALF_EDGE_TOPOLOGY: TriMeshFlags
    CONNECTED_COMPONENTS: TriMeshFlags
    DELETE_BAD_TOPOLOGY_TRIANGLES: TriMeshFlags
    ORIENTED: TriMeshFlags
    MERGE_DUPLICATE_VERTICES: TriMeshFlags
    DELETE_DEGENERATE_TRIANGLES: TriMeshFlags
    DELETE_DUPLICATE_TRIANGLES: TriMeshFlags
    FIX_INTERNAL_EDGES: TriMeshFlags
    def __init__(self, bits: int = 0) -> None: ...
    @staticmethod
    def empty() -> TriMeshFlags: ...

class ColliderMaterial:
    friction: float
    restitution: float
    friction_combine_rule: CoefficientCombineRule
    restitution_combine_rule: CoefficientCombineRule
    def __init__(self, friction: float = 1.0, restitution: float = 0.0) -> None: ...

class ColliderFlags:
    collision_groups: InteractionGroups
    solver_groups: InteractionGroups
    active_hooks: ActiveHooks
    active_events: ActiveEvents
    @property
    def enabled(self) -> ColliderEnabled: ...
    def __init__(self) -> None: ...

class ColliderParent:
    handle: RigidBodyHandle
    pos_wrt_parent: Isometry3
    def __init__(self, handle: RigidBodyHandle, pos_wrt_parent: IsometryLike) -> None: ...

class ColliderPosition:
    position: Isometry3
    def __init__(self, position: IsometryLike) -> None: ...

class ColliderMassProps:
    @staticmethod
    def Density(d: float) -> ColliderMassProps: ...
    @staticmethod
    def Mass(m: float) -> ColliderMassProps: ...
    @staticmethod
    def MassProperties(mp: MassProperties) -> ColliderMassProps: ...

class Ball:
    radius: float
    def __init__(self, radius: float) -> None: ...

class Cuboid:
    @property
    def half_extents(self) -> Vec3: ...
    def __init__(self, half_extents: VectorLike) -> None: ...

class Capsule:
    @property
    def radius(self) -> float: ...
    @property
    def half_height(self) -> float: ...
    @property
    def height(self) -> float: ...
    @property
    def a(self) -> Point3: ...
    @property
    def b(self) -> Point3: ...
    def __init__(self, a: VectorLike, b: VectorLike, radius: float) -> None: ...

class Cylinder:
    half_height: float
    radius: float
    def __init__(self, half_height: float, radius: float) -> None: ...

class Cone:
    half_height: float
    radius: float
    def __init__(self, half_height: float, radius: float) -> None: ...

class Triangle:
    @property
    def a(self) -> Point3: ...
    @property
    def b(self) -> Point3: ...
    @property
    def c(self) -> Point3: ...
    def __init__(self, a: VectorLike, b: VectorLike, c: VectorLike) -> None: ...

class TriMesh:
    @property
    def vertices(self) -> np.ndarray: ...
    @property
    def indices(self) -> np.ndarray: ...
    @property
    def flags(self) -> TriMeshFlags: ...
    def num_triangles(self) -> int: ...
    def num_vertices(self) -> int: ...

class HeightField:
    @property
    def scale(self) -> Vec3: ...

class ConvexPolyhedron:
    @property
    def points(self) -> np.ndarray: ...
    def num_points(self) -> int: ...
    @property
    def indices(self) -> np.ndarray: ...

class Compound:
    def num_shapes(self) -> int: ...
    def shapes(self) -> list[tuple[Isometry3, SharedShape]]: ...

class Voxels:
    @property
    def voxel_size(self) -> np.ndarray: ...
    @property
    def centers(self) -> np.ndarray: ...
    def num_voxels(self) -> int: ...

class Aabb:
    @property
    def mins(self) -> Point3: ...
    @property
    def maxs(self) -> Point3: ...
    @property
    def center(self) -> Point3: ...
    @property
    def half_extents(self) -> Vec3: ...
    @property
    def volume(self) -> float: ...
    def __init__(self, mins: VectorLike, maxs: VectorLike) -> None: ...

class BoundingSphere:
    @property
    def center(self) -> Point3: ...
    @property
    def radius(self) -> float: ...
    def __init__(self, center: VectorLike, radius: float) -> None: ...

class SharedShape:
    @property
    def shape_type(self) -> ShapeType: ...
    @staticmethod
    def ball(radius: float) -> SharedShape: ...
    @staticmethod
    def cuboid(hx: float, hy: float, hz: float) -> SharedShape: ...
    @staticmethod
    def round_cuboid(hx: float, hy: float, hz: float, border_radius: float) -> SharedShape: ...
    @staticmethod
    def capsule(a: VectorLike, b: VectorLike, radius: float) -> SharedShape: ...
    @staticmethod
    def capsule_x(half_height: float, radius: float) -> SharedShape: ...
    @staticmethod
    def capsule_y(half_height: float, radius: float) -> SharedShape: ...
    @staticmethod
    def capsule_z(half_height: float, radius: float) -> SharedShape: ...
    @staticmethod
    def cylinder(half_height: float, radius: float) -> SharedShape: ...
    @staticmethod
    def cone(half_height: float, radius: float) -> SharedShape: ...
    @staticmethod
    def round_cylinder(half_height: float, radius: float, border_radius: float) -> SharedShape: ...
    @staticmethod
    def round_cone(half_height: float, radius: float, border_radius: float) -> SharedShape: ...
    @staticmethod
    def triangle(a: VectorLike, b: VectorLike, c: VectorLike) -> SharedShape: ...
    @staticmethod
    def halfspace(outward_normal: VectorLike) -> SharedShape: ...
    @staticmethod
    def trimesh(vertices: np.ndarray, indices: np.ndarray, flags: TriMeshFlags | None = None) -> SharedShape: ...
    @staticmethod
    def convex_hull(points: np.ndarray) -> SharedShape: ...
    @staticmethod
    def convex_polyhedron(points: np.ndarray) -> SharedShape: ...
    @staticmethod
    def convex_decomposition(vertices: np.ndarray, indices: np.ndarray) -> SharedShape: ...
    @staticmethod
    def round_triangle(a: VectorLike, b: VectorLike, c: VectorLike, border_radius: float) -> SharedShape: ...
    @staticmethod
    def round_convex_hull(points: np.ndarray, border_radius: float) -> SharedShape: ...
    @staticmethod
    def convex_mesh(vertices: np.ndarray, indices: np.ndarray) -> SharedShape: ...
    @staticmethod
    def round_convex_mesh(vertices: np.ndarray, indices: np.ndarray, border_radius: float) -> SharedShape: ...
    @staticmethod
    def voxels(voxel_size: VectorLike, grid_coords: list[tuple[int, int, int]]) -> SharedShape: ...
    @staticmethod
    def voxels_from_points(voxel_size: VectorLike, points: np.ndarray) -> SharedShape: ...
    @staticmethod
    def heightfield(heights: np.ndarray, scale: VectorLike) -> SharedShape: ...
    @staticmethod
    def compound(parts: list[tuple[IsometryLike, SharedShape]]) -> SharedShape: ...
    def compute_aabb(self, pose: IsometryLike) -> Aabb: ...
    def compute_bounding_sphere(self, pose: IsometryLike) -> BoundingSphere: ...
    def compute_mass_properties(self, density: float) -> MassProperties: ...
    def mass_properties(self, density: float) -> MassProperties: ...
    def as_ball(self) -> Ball | None: ...
    def as_cuboid(self) -> Cuboid | None: ...
    def as_capsule(self) -> Capsule | None: ...
    def as_cylinder(self) -> Cylinder | None: ...
    def as_cone(self) -> Cone | None: ...
    def as_triangle(self) -> Triangle | None: ...
    def as_trimesh(self) -> TriMesh | None: ...
    def as_heightfield(self) -> HeightField | None: ...
    def as_convex_polyhedron(self) -> ConvexPolyhedron | None: ...
    def as_compound(self) -> Compound | None: ...
    def as_voxels(self) -> Voxels | None: ...

class MeshConverter:
    TRIMESH: MeshConverter
    OBB: MeshConverter
    BOUNDING_BOX: MeshConverter
    CONVEX_HULL: MeshConverter
    COMPOUND: MeshConverter
    CONVEX_DECOMPOSITION: MeshConverter
    @staticmethod
    def trimesh_with_flags(flags: TriMeshFlags) -> MeshConverter: ...
    def build(self, vertices: np.ndarray, indices: np.ndarray) -> tuple[SharedShape, Isometry3]: ...

class ColliderBuilder:
    def translation(self, v: VectorLike) -> ColliderBuilder: ...
    def position(self, p: IsometryLike) -> ColliderBuilder: ...
    def rotation(self, scaled_axis: VectorLike) -> ColliderBuilder: ...
    def density(self, d: float) -> ColliderBuilder: ...
    def mass(self, m: float) -> ColliderBuilder: ...
    def mass_properties(self, mp: MassProperties) -> ColliderBuilder: ...
    def friction(self, f: float) -> ColliderBuilder: ...
    def restitution(self, r: float) -> ColliderBuilder: ...
    def friction_combine_rule(self, r: CoefficientCombineRule) -> ColliderBuilder: ...
    def restitution_combine_rule(self, r: CoefficientCombineRule) -> ColliderBuilder: ...
    def sensor(self, b: bool) -> ColliderBuilder: ...
    def active_events(self, e: ActiveEvents) -> ColliderBuilder: ...
    def active_hooks(self, h: ActiveHooks) -> ColliderBuilder: ...
    def active_collision_types(self, t: ActiveCollisionTypes) -> ColliderBuilder: ...
    def collision_groups(self, g: InteractionGroups) -> ColliderBuilder: ...
    def solver_groups(self, g: InteractionGroups) -> ColliderBuilder: ...
    def contact_skin(self, f: float) -> ColliderBuilder: ...
    def contact_force_event_threshold(self, f: float) -> ColliderBuilder: ...
    def user_data(self, d: int) -> ColliderBuilder: ...
    def enabled(self, b: bool) -> ColliderBuilder: ...
    def build(self) -> Collider: ...

class Collider:
    position: Isometry3
    translation: Vec3
    rotation: Rotation3
    shape: SharedShape
    density: float
    mass: float
    mass_properties: MassProperties
    friction: float
    restitution: float
    friction_combine_rule: CoefficientCombineRule
    restitution_combine_rule: CoefficientCombineRule
    is_sensor: bool
    is_enabled: bool
    active_events: ActiveEvents
    active_hooks: ActiveHooks
    active_collision_types: ActiveCollisionTypes
    collision_groups: InteractionGroups
    solver_groups: InteractionGroups
    contact_skin: float
    contact_force_event_threshold: float
    user_data: int
    @property
    def parent(self) -> RigidBodyHandle | None: ...
    @property
    def material(self) -> ColliderMaterial: ...
    @property
    def volume(self) -> float: ...
    @staticmethod
    def ball(radius: float, **kwargs: Any) -> ColliderBuilder: ...
    @staticmethod
    def halfspace(outward_normal: VectorLike, **kwargs: Any) -> ColliderBuilder: ...
    @staticmethod
    def cuboid(hx: float, hy: float, hz: float, **kwargs: Any) -> ColliderBuilder: ...
    @staticmethod
    def capsule(half_height: float, radius: float) -> ColliderBuilder: ...
    @staticmethod
    def capsule_x(half_height: float, radius: float) -> ColliderBuilder: ...
    @staticmethod
    def capsule_y(half_height: float, radius: float) -> ColliderBuilder: ...
    @staticmethod
    def capsule_z(half_height: float, radius: float) -> ColliderBuilder: ...
    @staticmethod
    def capsule_from_endpoints(a: VectorLike, b: VectorLike, radius: float) -> ColliderBuilder: ...
    @staticmethod
    def cylinder(half_height: float, radius: float) -> ColliderBuilder: ...
    @staticmethod
    def cone(half_height: float, radius: float) -> ColliderBuilder: ...
    @staticmethod
    def round_cuboid(hx: float, hy: float, hz: float, border_radius: float) -> ColliderBuilder: ...
    @staticmethod
    def round_cylinder(half_height: float, radius: float, border_radius: float) -> ColliderBuilder: ...
    @staticmethod
    def round_cone(half_height: float, radius: float, border_radius: float) -> ColliderBuilder: ...
    @staticmethod
    def triangle(a: VectorLike, b: VectorLike, c: VectorLike) -> ColliderBuilder: ...
    @staticmethod
    def trimesh(vertices: np.ndarray, indices: np.ndarray, flags: TriMeshFlags | None = None) -> ColliderBuilder: ...
    @staticmethod
    def convex_hull(points: np.ndarray) -> ColliderBuilder: ...
    @staticmethod
    def convex_polyhedron(points: np.ndarray) -> ColliderBuilder: ...
    @staticmethod
    def convex_decomposition(vertices: np.ndarray, indices: np.ndarray) -> ColliderBuilder: ...
    @staticmethod
    def round_triangle(a: VectorLike, b: VectorLike, c: VectorLike, border_radius: float) -> ColliderBuilder: ...
    @staticmethod
    def round_convex_hull(points: np.ndarray, border_radius: float) -> ColliderBuilder: ...
    @staticmethod
    def convex_mesh(vertices: np.ndarray, indices: np.ndarray) -> ColliderBuilder: ...
    @staticmethod
    def round_convex_mesh(vertices: np.ndarray, indices: np.ndarray, border_radius: float) -> ColliderBuilder: ...
    @staticmethod
    def voxels(voxel_size: VectorLike, grid_coords: list[tuple[int, int, int]]) -> ColliderBuilder: ...
    @staticmethod
    def voxels_from_points(voxel_size: VectorLike, points: np.ndarray) -> ColliderBuilder: ...
    @staticmethod
    def converted_trimesh(vertices: np.ndarray, indices: np.ndarray, converter: MeshConverter) -> ColliderBuilder: ...
    @staticmethod
    def heightfield(heights: np.ndarray, scale: VectorLike) -> ColliderBuilder: ...
    @staticmethod
    def compound(parts: list[tuple[IsometryLike, SharedShape]]) -> ColliderBuilder: ...
    @staticmethod
    def new(shape: SharedShape) -> ColliderBuilder: ...
    def compute_aabb(self) -> Aabb: ...

class ColliderSet:
    def __init__(self) -> None: ...
    def insert(self, builder: Collider | ColliderBuilder) -> ColliderHandle: ...
    def insert_with_parent(
        self,
        builder: Collider | ColliderBuilder,
        parent: RigidBodyHandle,
        bodies: RigidBodySet,
    ) -> ColliderHandle: ...
    def remove(
        self,
        handle: ColliderHandle,
        islands: IslandManager,
        bodies: RigidBodySet,
        wake_parent: bool = True,
    ) -> Collider | None: ...
    def get(self, handle: ColliderHandle) -> Collider | None: ...
    def clear(self) -> None: ...
    def is_empty(self) -> bool: ...
    def handles(self) -> Iterator[ColliderHandle]: ...
    def __getitem__(self, handle: ColliderHandle) -> Collider: ...
    def __contains__(self, handle: ColliderHandle) -> bool: ...
    def __iter__(self) -> Iterator[Tuple[ColliderHandle, Collider]]: ...
    def __len__(self) -> int: ...

class ContactData:
    local_p1: Point3
    local_p2: Point3
    dist: float
    fid1: int
    fid2: int
    impulse: float
    tangent_impulse: tuple[float, float]
    contact_id: int

class ContactManifoldData:
    rigid_body1: RigidBodyHandle | None
    rigid_body2: RigidBodyHandle | None
    normal: Vec3
    num_active_contacts: int
    relative_dominance: int
    user_data: int

class ContactManifold:
    data: ContactManifoldData
    points: list[ContactData]
    local_n1: Vec3
    local_n2: Vec3
    subshape1: int
    subshape2: int

class ContactPair:
    @property
    def collider1(self) -> ColliderHandle: ...
    @property
    def collider2(self) -> ColliderHandle: ...
    @property
    def manifolds(self) -> list[ContactManifold]: ...
    @property
    def has_any_active_contact(self) -> bool: ...
    def find_deepest_contact(self) -> ContactData | None: ...
    def total_impulse(self) -> Vec3: ...
    def total_impulse_magnitude(self) -> float: ...

class IntersectionPair:
    collider1: ColliderHandle
    collider2: ColliderHandle
    intersecting: bool

class ColliderPair:
    collider1: ColliderHandle
    collider2: ColliderHandle
    def __init__(self, collider1: ColliderHandle, collider2: ColliderHandle) -> None: ...
    def __getitem__(self, idx: int) -> ColliderHandle: ...
    def __len__(self) -> int: ...

class BroadPhasePairEvent:
    added: bool
    pair: ColliderPair
    @staticmethod
    def added(pair: ColliderPair) -> BroadPhasePairEvent: ...
    @staticmethod
    def removed(pair: ColliderPair) -> BroadPhasePairEvent: ...

class CollisionEvent:
    started: bool
    collider1: ColliderHandle
    collider2: ColliderHandle
    flags: CollisionEventFlags
    @property
    def stopped(self) -> bool: ...
    @property
    def sensor(self) -> bool: ...
    @property
    def removed(self) -> bool: ...
    @staticmethod
    def STARTED(c1: ColliderHandle, c2: ColliderHandle, flags: CollisionEventFlags) -> CollisionEvent: ...
    @staticmethod
    def STOPPED(c1: ColliderHandle, c2: ColliderHandle, flags: CollisionEventFlags) -> CollisionEvent: ...

class ContactForceEvent:
    collider1: ColliderHandle
    collider2: ColliderHandle
    total_force: Vec3
    total_force_magnitude: float
    max_force_direction: Vec3
    max_force_magnitude: float

class BvhOptimizationStrategy:
    AUTO: BvhOptimizationStrategy
    NO_OPTIMIZATION: BvhOptimizationStrategy
    OPTIMIZE_FOR_INTERACTIONS: BvhOptimizationStrategy
    OPTIMIZE_FOR_SPATIAL_QUERIES: BvhOptimizationStrategy
    SUBTREE_OPTIMIZER: BvhOptimizationStrategy
    NONE: BvhOptimizationStrategy

class BroadPhaseBvh:
    def __init__(self) -> None: ...
    @staticmethod
    def optimized_for(strategy: BvhOptimizationStrategy) -> BroadPhaseBvh: ...
    def clear(self) -> None: ...

class SolverContact:
    point: Point3
    point2: Point3
    dist: float
    contact_id: int
    is_new: bool

class NarrowPhase:
    def __init__(self) -> None: ...
    def contact_pair(self, h1: ColliderHandle, h2: ColliderHandle) -> ContactPair | None: ...
    def intersection_pair(self, h1: ColliderHandle, h2: ColliderHandle) -> bool | None: ...
    def contact_pairs(self) -> list[ContactPair]: ...
    def intersection_pairs(self) -> list[tuple[ColliderHandle, ColliderHandle, bool]]: ...
    def clear(self) -> None: ...

# ---- events / hooks (phase 07) -------------------------------------------

class SolverFlags:
    COMPUTE_IMPULSES: SolverFlags
    EMPTY: SolverFlags
    def __init__(self, bits: int = 0) -> None: ...
    @staticmethod
    def empty() -> SolverFlags: ...
    @property
    def bits(self) -> int: ...
    def contains(self, other: SolverFlags) -> bool: ...
    def is_empty(self) -> bool: ...
    def __or__(self, other: SolverFlags) -> SolverFlags: ...
    def __and__(self, other: SolverFlags) -> SolverFlags: ...
    def __xor__(self, other: SolverFlags) -> SolverFlags: ...
    def __invert__(self) -> SolverFlags: ...

class PairFilterContext:
    @property
    def collider1(self) -> ColliderHandle: ...
    @property
    def collider2(self) -> ColliderHandle: ...
    @property
    def rigid_body1(self) -> RigidBodyHandle | None: ...
    @property
    def rigid_body2(self) -> RigidBodyHandle | None: ...

class ContactModificationContext:
    @property
    def collider1(self) -> ColliderHandle: ...
    @property
    def collider2(self) -> ColliderHandle: ...
    @property
    def rigid_body1(self) -> RigidBodyHandle | None: ...
    @property
    def rigid_body2(self) -> RigidBodyHandle | None: ...
    @property
    def local_n1(self) -> Vec3: ...
    @property
    def local_n2(self) -> Vec3: ...
    normal: Vec3
    friction: float
    restitution: float
    user_data: int
    @property
    def solver_contacts(self) -> list[SolverContact]: ...
    def clear_solver_contacts(self) -> None: ...
    def num_solver_contacts(self) -> int: ...
    def remove_solver_contact(self, i: int) -> None: ...
    def update_as_oneway_platform(self, allowed_local_n1: Vec3 | tuple[float, float, float], angle: float) -> None: ...

class ChannelEventCollector:
    def __init__(self) -> None: ...
    def drain_collision_events(self) -> list[CollisionEvent]: ...
    def drain_contact_force_events(self) -> list[ContactForceEvent]: ...
    def clear(self) -> None: ...
    def __len__(self) -> int: ...

# ---- controllers (phase 08) ----------------------------------------------

from typing import Callable, Literal

class CharacterLength:
    kind: Literal["absolute", "relative"]
    value: float
    def __init__(self, value: float = 0.0, kind: str = "absolute") -> None: ...
    @staticmethod
    def absolute(value: float) -> CharacterLength: ...
    @staticmethod
    def relative(value: float) -> CharacterLength: ...

class CharacterAutostep:
    max_height: CharacterLength
    min_width: CharacterLength
    include_dynamic_bodies: bool
    def __init__(
        self,
        max_height: CharacterLength | float | None = None,
        min_width: CharacterLength | float | None = None,
        include_dynamic_bodies: bool = True,
    ) -> None: ...
    @staticmethod
    def disabled() -> None: ...

class EffectiveCharacterMovement:
    @property
    def translation(self) -> Vec3: ...
    @property
    def grounded(self) -> bool: ...
    @property
    def is_sliding_down_slope(self) -> bool: ...

class CharacterCollision:
    @property
    def handle(self) -> ColliderHandle: ...
    @property
    def character_pos(self) -> Isometry3: ...
    @property
    def translation_applied(self) -> Vec3: ...
    @property
    def translation_remaining(self) -> Vec3: ...
    @property
    def toi(self) -> ShapeCastHit: ...

class KinematicCharacterController:
    up: Vec3
    offset: CharacterLength
    slide: bool
    autostep: CharacterAutostep | None
    max_slope_climb_angle: float
    min_slope_slide_angle: float
    snap_to_ground: CharacterLength | None
    normal_nudge_factor: float
    def __init__(
        self,
        *,
        up: Vec3 | tuple[float, float, float] | None = None,
        offset: CharacterLength | float | None = None,
        slide: bool | None = None,
        autostep: CharacterAutostep | None = None,
        max_slope_climb_angle: float | None = None,
        min_slope_slide_angle: float | None = None,
        snap_to_ground: CharacterLength | float | None = None,
        normal_nudge_factor: float | None = None,
    ) -> None: ...
    def move_shape(
        self,
        dt: float,
        bodies: RigidBodySet,
        colliders: ColliderSet,
        queries: QueryPipeline,
        shape: SharedShape,
        shape_pos: Isometry3,
        desired_translation: Vec3 | tuple[float, float, float],
        filter: QueryFilter | None = None,
        events_callback: Callable[[CharacterCollision], None] | None = None,
    ) -> EffectiveCharacterMovement: ...
    def solve_character_collision_impulses(
        self,
        dt: float,
        bodies: RigidBodySet,
        colliders: ColliderSet,
        queries: QueryPipeline,
        character_shape: SharedShape,
        character_pos: Isometry3,
        character_mass: float,
        collisions: list[CharacterCollision],
        filter: QueryFilter | None = None,
    ) -> None: ...

class AxesMask:
    LIN_X: AxesMask
    LIN_Y: AxesMask
    LIN_Z: AxesMask
    ANG_X: AxesMask
    ANG_Y: AxesMask
    ANG_Z: AxesMask
    def __init__(self, bits: int = 0) -> None: ...
    @staticmethod
    def empty() -> AxesMask: ...
    @staticmethod
    def all() -> AxesMask: ...
    @staticmethod
    def all_axes() -> AxesMask: ...
    @property
    def bits(self) -> int: ...
    def contains(self, other: AxesMask) -> bool: ...
    def is_empty(self) -> bool: ...
    def __or__(self, other: AxesMask) -> AxesMask: ...
    def __and__(self, other: AxesMask) -> AxesMask: ...
    def __xor__(self, other: AxesMask) -> AxesMask: ...
    def __invert__(self) -> AxesMask: ...
    def __sub__(self, other: AxesMask) -> AxesMask: ...
    def __contains__(self, other: AxesMask) -> bool: ...

class PdErrors:
    linear: Vec3
    angular: Vec3
    def __init__(
        self,
        linear: Vec3 | tuple[float, float, float] | None = None,
        angular: Vec3 | tuple[float, float, float] | None = None,
    ) -> None: ...

class PidCorrection:
    @property
    def linear(self) -> Vec3: ...
    @property
    def angular(self) -> Vec3: ...

class PdController:
    axes: AxesMask
    def __init__(
        self,
        axes: AxesMask | None = None,
        Kp: Vec3 | tuple[float, float, float] | float | None = None,
        Kd: Vec3 | tuple[float, float, float] | float | None = None,
    ) -> None: ...
    def set_axes_kp(self, v: Vec3 | tuple[float, float, float]) -> None: ...
    def set_axes_kd(self, v: Vec3 | tuple[float, float, float]) -> None: ...
    def rigid_body_correction(self, body: RigidBody, target_pose: Isometry3) -> PidCorrection: ...
    def correction(self, pose_errors: PdErrors, vel_errors: PdErrors) -> PidCorrection: ...

class PidController:
    axes: AxesMask
    def __init__(
        self,
        axes: AxesMask | None = None,
        Kp: Vec3 | tuple[float, float, float] | float | None = None,
        Ki: Vec3 | tuple[float, float, float] | float | None = None,
        Kd: Vec3 | tuple[float, float, float] | float | None = None,
    ) -> None: ...
    def set_axes_kp(self, v: Vec3 | tuple[float, float, float]) -> None: ...
    def set_axes_ki(self, v: Vec3 | tuple[float, float, float]) -> None: ...
    def set_axes_kd(self, v: Vec3 | tuple[float, float, float]) -> None: ...
    def reset(self) -> None: ...
    def rigid_body_correction(self, dt: float, body: RigidBody, target_pose: Isometry3) -> PidCorrection: ...
    def position_correction(self, dt: float, position: Isometry3, target_position: Isometry3) -> PidCorrection: ...
    def update(self, dt: float, pose_errors: PdErrors, vel_errors: PdErrors) -> PidCorrection: ...

class WheelTuning:
    suspension_stiffness: float
    suspension_compression: float
    suspension_damping: float
    max_suspension_travel: float
    side_friction_stiffness: float
    friction_slip: float
    max_suspension_force: float
    def __init__(
        self,
        suspension_stiffness: float | None = None,
        suspension_compression: float | None = None,
        suspension_damping: float | None = None,
        max_suspension_travel: float | None = None,
        side_friction_stiffness: float | None = None,
        friction_slip: float | None = None,
        max_suspension_force: float | None = None,
    ) -> None: ...
    @staticmethod
    def default() -> WheelTuning: ...

class RayCastInfo:
    @property
    def contact_normal_ws(self) -> Vec3: ...
    @property
    def contact_point_ws(self) -> Vec3: ...
    @property
    def suspension_length(self) -> float: ...
    @property
    def hard_point_ws(self) -> Vec3: ...
    @property
    def is_in_contact(self) -> bool: ...
    @property
    def ground_object(self) -> ColliderHandle | None: ...

class Wheel:
    chassis_connection_point_cs: Vec3
    direction_cs: Vec3
    axle_cs: Vec3
    suspension_rest_length: float
    max_suspension_travel: float
    radius: float
    suspension_stiffness: float
    damping_compression: float
    damping_relaxation: float
    friction_slip: float
    side_friction_stiffness: float
    rotation: float
    max_suspension_force: float
    forward_impulse: float
    side_impulse: float
    steering: float
    engine_force: float
    brake: float
    wheel_suspension_force: float
    @property
    def raycast_info(self) -> RayCastInfo: ...

class DynamicRayCastVehicleController:
    index_up_axis: int
    index_forward_axis: int
    def __init__(self, chassis_handle: RigidBodyHandle) -> None: ...
    def add_wheel(
        self,
        chassis_connection_cs: Vec3 | tuple[float, float, float],
        direction_cs: Vec3 | tuple[float, float, float],
        axle_cs: Vec3 | tuple[float, float, float],
        suspension_rest_length: float,
        radius: float,
        tuning: WheelTuning,
    ) -> int: ...
    def update_vehicle(
        self,
        dt: float,
        bodies: RigidBodySet,
        colliders: ColliderSet,
        queries: QueryPipeline,
        filter: QueryFilter | None = None,
    ) -> None: ...
    def set_brake(self, idx: int, brake: float) -> None: ...
    def set_steering(self, idx: int, steering: float) -> None: ...
    def apply_engine_force(self, idx: int, force: float) -> None: ...
    def wheels(self) -> list[Wheel]: ...
    def wheel(self, idx: int) -> Wheel: ...
    def current_speed_km_hour(self) -> float: ...
    @property
    def current_vehicle_speed(self) -> float: ...
    def chassis(self) -> RigidBodyHandle: ...

# ---- debug-render (phase 10) ---------------------------------------------

class DebugRenderObject:
    kind: int
    RIGID_BODY: DebugRenderObject
    COLLIDER: DebugRenderObject
    COLLIDER_AABB: DebugRenderObject
    IMPULSE_JOINT: DebugRenderObject
    MULTIBODY_JOINT: DebugRenderObject
    CONTACT_PAIR: DebugRenderObject

class DebugColor:
    def __init__(self, h: float = 0.0, s: float = 0.0, l: float = 0.0, a: float = 1.0) -> None: ...
    @staticmethod
    def from_hsla(h: float, s: float, l: float, a: float) -> DebugColor: ...
    @staticmethod
    def from_rgba(r: float, g: float, b: float, a: float) -> DebugColor: ...
    @property
    def hsla(self) -> list[float]: ...
    @property
    def rgba(self) -> list[float]: ...
    @property
    def h(self) -> float: ...
    @property
    def s(self) -> float: ...
    @property
    def l(self) -> float: ...
    @property
    def a(self) -> float: ...

class DebugRenderMode:
    def __init__(self, bits: int = 0) -> None: ...
    @staticmethod
    def empty() -> DebugRenderMode: ...
    @staticmethod
    def default() -> DebugRenderMode: ...
    @staticmethod
    def all() -> DebugRenderMode: ...
    COLLIDER_SHAPES: DebugRenderMode
    RIGID_BODY_AXES: DebugRenderMode
    MULTIBODY_JOINTS: DebugRenderMode
    IMPULSE_JOINTS: DebugRenderMode
    JOINTS: DebugRenderMode
    SOLVER_CONTACTS: DebugRenderMode
    CONTACTS: DebugRenderMode
    COLLIDER_AABBS: DebugRenderMode
    EMPTY: DebugRenderMode
    @property
    def bits(self) -> int: ...
    def contains(self, other: DebugRenderMode) -> bool: ...
    def is_empty(self) -> bool: ...
    def __or__(self, other: DebugRenderMode) -> DebugRenderMode: ...
    def __and__(self, other: DebugRenderMode) -> DebugRenderMode: ...
    def __xor__(self, other: DebugRenderMode) -> DebugRenderMode: ...
    def __invert__(self) -> DebugRenderMode: ...
    def __bool__(self) -> bool: ...

class DebugRenderStyle:
    def __init__(self) -> None: ...
    @staticmethod
    def default() -> DebugRenderStyle: ...
    subdivisions: int
    border_subdivisions: int
    collider_dynamic_color: DebugColor
    collider_fixed_color: DebugColor
    collider_kinematic_color: DebugColor
    collider_parentless_color: DebugColor
    impulse_joint_anchor_color: DebugColor
    impulse_joint_separation_color: DebugColor
    multibody_joint_anchor_color: DebugColor
    multibody_joint_separation_color: DebugColor
    sleep_color_multiplier: DebugColor
    sleep_eligible_color_multiplier: DebugColor
    disabled_color_multiplier: DebugColor
    rigid_body_axes_length: float
    contact_depth_color: DebugColor
    contact_normal_color: DebugColor
    contact_normal_length: float
    collider_aabb_color: DebugColor

class DebugLineCollector:
    def __init__(self) -> None: ...
    def clear(self) -> None: ...
    def lines(self) -> np.ndarray: ...
    def colors(self) -> np.ndarray: ...
    def objects(self) -> np.ndarray: ...
    def __len__(self) -> int: ...
    def __iter__(self) -> Iterator[tuple[DebugRenderObject, Vec3, Vec3, DebugColor]]: ...

class DebugRenderPipeline:
    mode: DebugRenderMode
    style: DebugRenderStyle
    def __init__(
        self,
        mode: DebugRenderMode | None = None,
        style: DebugRenderStyle | None = None,
    ) -> None: ...
    def render(
        self,
        bodies: RigidBodySet,
        colliders: ColliderSet,
        impulse_joints: ImpulseJointSet,
        multibody_joints: MultibodyJointSet,
        narrow_phase: NarrowPhase,
        backend: Any,
    ) -> None: ...
    def render_to_arrays(
        self,
        bodies: RigidBodySet,
        colliders: ColliderSet,
        impulse_joints: ImpulseJointSet,
        multibody_joints: MultibodyJointSet,
        narrow_phase: NarrowPhase,
    ) -> tuple[np.ndarray, np.ndarray, np.ndarray]: ...
