bones.py

Miscellaneous things for LunaEngine

This module provides classes for creating and manipulating bone-based skeletal structures.

LOCATION: lunaengine/misc/bones.py

class Joint

Description

Represents a joint in a skeletal system that can rotate.

Methods
def __init__(self: Any, x: int, y: int, angle: float = 0, show_joint: bool = True) -> Any
No documentation
def set_position(self: Any, x: int, y: int) -> None
Set the position of the joint.
def set_angle(self: Any, angle: float) -> None
Set the rotation angle of the joint.
def get_end_position(self: Any, length: int) -> Tuple[int, int]
Calculate the endpoint position given a length and angle.
def render(self: Any, renderer: OpenGLRenderer, color: Tuple[int, int, int] = (255, 100, 100), radius: int = 5) -> None
Render the joint.

class Bone

Description

Represents a bone segment that connects a joint to an endpoint.

Methods
def __init__(self: Any, joint: Joint, length: int, width: int = 3, color: Tuple[int, int, int] = (255, 255, 255)) -> Any
No documentation
def _calculate_end_position(self: Any) -> None
Calculate the end position based on joint angle and length.
def set_color(self: Any, color: Tuple[int, int, int]) -> None
Set the color of the bone.
def set_width(self: Any, width: int) -> None
Set the width of the bone.
def set_angle(self: Any, angle: float) -> None
Set the angle of the bone's joint.
def get_end_position(self: Any) -> Tuple[int, int]
Get the end position of the bone.
def render(self: Any, renderer: OpenGLRenderer) -> None
Render the bone.

class Skeleton

Description

A hierarchical skeleton system with joints and bones.

Methods
def __init__(self: Any) -> Any
No documentation
def add_joint(self: Any, name: str, joint: Joint, parent_joint: Optional[str] = None) -> None
Add a joint to the skeleton.
def add_bone(self: Any, name: str, bone: Bone, parent_bone: Optional[str] = None) -> None
Add a bone to the skeleton.
def set_bone_angle(self: Any, name: str, angle: float) -> None
Set the angle of a bone.
def set_bone_color(self: Any, name: str, color: Tuple[int, int, int]) -> None
Set the color of a bone.
def set_all_bones_color(self: Any, color: Tuple[int, int, int]) -> None
Set the color of all bones.
def set_bone_width(self: Any, name: str, width: int) -> None
Set the width of a bone.
def set_all_bones_width(self: Any, width: int) -> None
Set the width of all bones.
def set_joints_visible(self: Any, visible: bool) -> None
Set visibility of all joints.
def render(self: Any, renderer: OpenGLRenderer) -> None
Render the entire skeleton.

class HumanBones

Description

Human skeleton with proper rotation.

Methods
def __init__(self: Any, x: int = 400, y: int = 300, scale: float = 1.0) -> Any
No documentation
def _create_skeleton(self: Any) -> Any
Create the human skeleton with proper hierarchy.
def _update_positions(self: Any) -> Any
Update positions of all bones based on hierarchy.

class DogBones

Description

Dog skeleton with proper rotation.

Methods
def __init__(self: Any, x: int = 400, y: int = 300, scale: float = 1.0) -> Any
No documentation
def _create_skeleton(self: Any) -> Any
Create a simple dog skeleton with hierarchy.
def _update_positions(self: Any) -> Any
Update positions of all bones based on hierarchy.

class CatBones

Description

Cat skeleton with proper rotation.

Methods
def __init__(self: Any, x: int = 400, y: int = 300, scale: float = 1.0) -> Any
No documentation
def _create_skeleton(self: Any) -> Any
Create a simple cat skeleton with hierarchy.
def _update_positions(self: Any) -> Any
Update positions of all bones based on hierarchy.

class HorseBones

Description

Horse skeleton with proper rotation.

Methods
def __init__(self: Any, x: int = 400, y: int = 300, scale: float = 1.0) -> Any
No documentation
def _create_skeleton(self: Any) -> Any
Create a simple horse skeleton with hierarchy.
def _update_positions(self: Any) -> Any
Update positions of all bones based on hierarchy.
Back to Misc Module