CLASS v1.8.0

physics.MouseJoint

pykraken.physics.MouseJoint

A joint that pulls a body toward a world-space target point using a spring.

More about physics.MouseJoint

The mouse joint is typically used for click-and-drag interactions, where a user drags a body around the world. It applies a spring force to pull the body toward the target position.

Inherits Joint

Reference

PYTHON API
physics.MouseJoint(/, *args, **kwargs)

Initialize self. See help(type(self)) for accurate signature.

body_a

property
body_a: physics.Body

The first body attached to the joint.

body_b

property
body_b: physics.Body

The second body attached to the joint.

collide_connected: bool

Whether the connected bodies should collide with each other.

is_valid

property
is_valid: bool

Indicates whether the joint is not destroyed.

local_anchor_a: Vec2

The local anchor point relative to body A's origin.

local_anchor_b: Vec2

The local anchor point relative to body B's origin.

max_force

property
max_force: float

The maximum constraint force.

spring_damping_ratio: float

The spring damping ratio.

spring_hz

property
spring_hz: float

The spring frequency in Hertz.

target

property
target: Vec2

The target point in world coordinates.

destroy

method
destroy(self) -> None

Destroy the joint manually.

Find your next step

Start typing to search the manual.