ke.motion_module

Python motion sampling, editor panels, and debug visualization modules.

API overview

MotionEditor

Motion playback, sequencer UI, and pluggable motion modules.

MotionPlayer

Track playback time and select frames from a sampled motion.

MotionModule

Base interface for optional MotionEditor processing and visualization.

RootTrajectoryModule

Visualize root positions, directions, and velocities around the playhead.

TrackingModule

Visualize selected joint trajectories and velocities around the playhead.

ContactModule

Estimate and visualize foot contacts from motion samples.

class kangengine.motion_module.MotionSampleData(
positions: ndarray,
matrices: ndarray,
velocities: ndarray,
node_names: list[str],
fps: float,
mapper: JointMapper,
) None[python]
classmethod from_motion(
motion,
profiles=None,
) MotionSampleData
Return type:

MotionSampleData

joint_indices(names: list[str]) list[int]
Return type:

list[int]

semantic_indices(
semantics: list[JointSemantic | str],
) list[int]
Return type:

list[int]

positions
matrices
velocities
node_names
fps
mapper
class kangengine.motion_module.RootTrajectoryData(
positions: ndarray,
velocities: ndarray,
directions: ndarray,
) None[python]
classmethod from_motion(
motion,
root_index: int = 0,
samples: MotionSampleData | None = None,
) RootTrajectoryData
Return type:

RootTrajectoryData

positions
velocities
directions
class kangengine.motion_module.TrackingData(
positions: ndarray,
velocities: ndarray,
joint_indices: list[int],
joint_names: list[str],
) None[python]
classmethod from_motion(
motion,
joint_names: list[str] | None = None,
joint_indices: list[int] | None = None,
joint_semantics: list[JointSemantic | str] | None = None,
samples: MotionSampleData | None = None,
) TrackingData
Return type:

TrackingData

positions
velocities
joint_indices
joint_names
class kangengine.motion_module.ContactData(
positions: ndarray,
velocities: ndarray,
foot_indices: list[int],
foot_names: list[str],
up_axis: int = 1,
) None[python]
contacts(
height_threshold: float,
velocity_threshold: float,
) ndarray
Return type:

ndarray

classmethod from_motion(
motion,
foot_names: list[str] | None = None,
foot_indices: list[int] | None = None,
foot_semantics: list[JointSemantic | str] | None = None,
up_axis: int = 1,
samples: MotionSampleData | None = None,
) ContactData
Return type:

ContactData

up_axis = 1
positions
velocities
foot_indices
foot_names
class kangengine.motion_module.MotionCameraFollower(
motion,
samples: MotionSampleData | None = None,
target_semantic: JointSemantic | str = JointSemantic.HIPS,
target_index: int | None = None,
target_offset=(0.0, 0.85, 0.0),
camera_offset=(0.0, 0.65, 3.2),
smoothing: float = 0.12,
)[python]
target_at(frame_index: int) ndarray
Return type:

ndarray

update(camera, frame_index: int, force: bool = False) None
Return type:

None

class kangengine.motion_module.MotionPlayer(
duration: float,
fps: float,
num_frames: int,
time: float = 0.0,
playing: bool = True,
loop: bool = True,
time_scale: float = 1.0,
) None[python]

Track playback time and select frames from a sampled motion.

property frame_index
classmethod from_motion(
motion,
playing: bool = True,
) MotionPlayer
Return type:

MotionPlayer

loop = True
property normalized_time
property playback_duration
playing = True
reset() None
Return type:

None

set_frame(frame: int) None
Return type:

None

time = 0.0
time_scale = 1.0
update(dt: float) bool
Return type:

bool

duration
fps
num_frames
class kangengine.motion_module.MotionEditor(
motion,
motion_name: str = 'Motion',
panel_name: str = 'MotionSequencer',
fit_to_content: bool = True,
) None[python]

Motion playback, sequencer UI, and pluggable motion modules.

add_module(module)
global_positions() ndarray
Return type:

ndarray

motion_samples() MotionSampleData
Return type:

MotionSampleData

render() bool
Return type:

bool

render_modules_ui() bool
Return type:

bool

render_panel(motion_name: str | None = None) bool
Return type:

bool

render_panel_py(motion_name: str | None = None) bool
Return type:

bool

reset() None
Return type:

None

set_playing(playing: bool)
update(dt: float) bool
Return type:

bool

update_modules(state=None) None
Return type:

None

class kangengine.motion_module.MotionModule(name: str)[python]

Base interface for optional MotionEditor processing and visualization.

initialize(editor: MotionEditor) None
Return type:

None

ui(editor: MotionEditor) bool
Return type:

bool

update(editor: MotionEditor, state=None) None
Return type:

None

class kangengine.motion_module.RootTrajectoryModule(
app,
path: str = '/debug/root_trajectory',
root_index: int = 0,
line_width: float = 2.0,
point_size: float = 10.0,
)[python]

Bases: MotionModule

Visualize root positions, directions, and velocities around the playhead.

initialize(editor: MotionEditor) None
Return type:

None

ui(editor: MotionEditor) bool
Return type:

bool

update(
editor: MotionEditor,
state=None,
) None
Return type:

None

class kangengine.motion_module.TrackingModule(
app,
path: str = '/debug/motion_tracking',
joint_names: list[str] | None = None,
joint_indices: list[int] | None = None,
joint_semantics: list[JointSemantic | str] | None = None,
line_width: float = 2.0,
point_size: float = 9.0,
)[python]

Bases: MotionModule

Visualize selected joint trajectories and velocities around the playhead.

initialize(editor: MotionEditor) None
Return type:

None

ui(editor: MotionEditor) bool
Return type:

bool

update(
editor: MotionEditor,
state=None,
) None
Return type:

None

class kangengine.motion_module.ContactModule(
app,
path: str = '/debug/motion_contacts',
foot_names: list[str] | None = None,
foot_indices: list[int] | None = None,
foot_semantics: list[JointSemantic | str] | None = None,
up_axis: int = 1,
point_size: float = 20.0,
)[python]

Bases: MotionModule

Estimate and visualize foot contacts from motion samples.

initialize(editor: MotionEditor) None
Return type:

None

ui(editor: MotionEditor) bool
Return type:

bool

update(editor: MotionEditor, state=None) None
Return type:

None

class kangengine.motion_module.TargetModule(
app,
path: str = '/debug/motion_target',
source_semantic: JointSemantic | str = JointSemantic.RIGHT_HAND,
source_index: int | None = None,
target_offset=(0.25, 0.15, 0.0),
target_euler_extrinsic_xyz_deg=(0.0, 0.0, 0.0),
target_transform=None,
offset_frame: str = 'root',
point_size: float = 18.0,
line_width: float = 2.0,
)[python]

Bases: MotionModule

OFFSET_FRAMES = ('world', 'root', 'source')
initialize(editor: MotionEditor) None
Return type:

None

offset_frame_rotation(frame_index: int) ndarray
Return type:

ndarray

source_position(frame_index: int) ndarray
Return type:

ndarray

source_rotation(frame_index: int) ndarray
Return type:

ndarray

target_position(frame_index: int) ndarray
Return type:

ndarray

target_rotation(frame_index: int) ndarray
Return type:

ndarray

target_world_transform(frame_index: int) ndarray
Return type:

ndarray

ui(editor: MotionEditor) bool
Return type:

bool

update(editor: MotionEditor, state=None) None
Return type:

None