struct

Flock::Collision::Joint2D

Inherits Struct < Value < Object

A constraint between two bodies (use a Static body as a fixed world anchor). Anchors are in each body's local frame. Held in Physics2D.joints.

Constructors

distance(a : Flock::Entity, b : Flock::Entity, length : Number, anchor_a : Flock::Vec2 = Flock::Vec2.new, anchor_b : Flock::Vec2 = Flock::Vec2.new) : Joint2D
Source
new(a : Flock::Entity, b : Flock::Entity, type : Flock::Collision::JointType, anchor_a : Flock::Vec2 = Flock::Vec2.new, anchor_b : Flock::Vec2 = Flock::Vec2.new, length : Float32 = 0.0_f32, stiffness : Float32 = 100.0_f32, damping : Float32 = 1.0_f32, min_length : Float32 = 0.0_f32, max_length : Float32 = 0.0_f32, motor_speed : Float32 = 0.0_f32, max_motor_torque : Float32 = 0.0_f32, enable_limit : Bool = false, lower_angle : Float32 = 0.0_f32, upper_angle : Float32 = 0.0_f32, reference_angle : Float32 = 0.0_f32)
Source
pin(a : Flock::Entity, b : Flock::Entity, anchor_a : Flock::Vec2 = Flock::Vec2.new, anchor_b : Flock::Vec2 = Flock::Vec2.new) : Joint2D
Source
revolute(a : Flock::Entity, b : Flock::Entity, anchor_a : Flock::Vec2 = Flock::Vec2.new, anchor_b : Flock::Vec2 = Flock::Vec2.new, motor_speed : Number = 0.0, max_motor_torque : Number = 0.0, enable_limit : Bool = false, lower_angle : Number = 0.0, upper_angle : Number = 0.0, reference_angle : Number = 0.0) : Joint2D

A revolute joint with an optional angular motor and/or angle limits.

Source
rope(a : Flock::Entity, b : Flock::Entity, max_length : Number, min_length : Number = 0.0, anchor_a : Flock::Vec2 = Flock::Vec2.new, anchor_b : Flock::Vec2 = Flock::Vec2.new) : Joint2D

A rope: the two anchors may come closer than max_length freely but never exceed it (set min_length for a two-sided limit).

Source
spring(a : Flock::Entity, b : Flock::Entity, length : Number, stiffness : Number = 100.0, damping : Number = 1.0, anchor_a : Flock::Vec2 = Flock::Vec2.new, anchor_b : Flock::Vec2 = Flock::Vec2.new) : Joint2D
Source

Instance methods

a=(a : Flock::Entity)
Source
anchor_a
Source
anchor_a=(anchor_a : Flock::Vec2)
Source
anchor_b
Source
anchor_b=(anchor_b : Flock::Vec2)
Source
b=(b : Flock::Entity)
Source
damping
Source
damping=(damping : Float32)
Source
enable_limit

Revolute (Pin) angle limits on (rotb - rota - reference_angle).

Source
enable_limit=(enable_limit : Bool)

Revolute (Pin) angle limits on (rotb - rota - reference_angle).

Source
length
Source
length=(length : Float32)
Source
lower_angle
Source
lower_angle=(lower_angle : Float32)
Source
max_length
Source
max_length=(max_length : Float32)
Source
max_motor_torque
Source
max_motor_torque=(max_motor_torque : Float32)
Source
min_length

Rope mode (Distance): when max_length > 0 the joint only acts outside [min_length, max_length].

Source
min_length=(min_length : Float32)

Rope mode (Distance): when max_length > 0 the joint only acts outside [min_length, max_length].

Source
motor_speed

Revolute (Pin) angular motor: drives (ωb - ωa) toward motor_speed, capped at max_motor_torque. Enabled when max_motor_torque > 0.

Source
motor_speed=(motor_speed : Float32)

Revolute (Pin) angular motor: drives (ωb - ωa) toward motor_speed, capped at max_motor_torque. Enabled when max_motor_torque > 0.

Source
reference_angle
Source
reference_angle=(reference_angle : Float32)
Source
stiffness
Source
stiffness=(stiffness : Float32)
Source
type
Source
type=(type : JointType)
Source
upper_angle
Source
upper_angle=(upper_angle : Float32)
Source