Scripting API

Scripting API

HingeJoint2D

Struct in Abyss.Physics2D, from Abyss.Physics2D.

Two bodies held turning about one point, as a door on its hinge or a wheel on its axle: the body this is on — the nearest Rigidbody 2D at or above its entity — and HingeJoint2D.ConnectedBody, or a point in the world where that is none. Its motor turns it; its limits stop it turning past two angles.

public struct HingeJoint2D

Remarks

Where the two are held is HingeJoint2D.Anchor on this body, in its entity's own units, and HingeJoint2D.ConnectedAnchor on the other, in that entity's, or in the world's where there is none; with HingeJoint2D.AutoConfigureConnectedAnchor the joint is made with the connected anchor where the anchor is, and says where that was.

Its angle is this body's turn from the connected one's, from the angle they were at as it was made; HingeJoint2D.LowerAngle and HingeJoint2D.UpperAngle are from there, in degrees, each within 178 either way, as Box2D measures a hinge's angle no further than a half turn. It breaks — taken off its entity, and said in Physics2D.JointsBroken — when it holds harder than HingeJoint2D.BreakForce or HingeJoint2D.BreakTorque.

Fields

ConnectedBody

public EntityRef ConnectedBody

The other body: an entity with a Rigidbody 2D, or under one; none for a point in the world.

EnableCollision

public bool EnableCollision

Whether the two bodies still meet each other.

AutoConfigureConnectedAnchor

public bool AutoConfigureConnectedAnchor

Whether the connected anchor is made where the anchor is as the joint is made.

Anchor

public Vector2 Anchor

Where it holds this body, in its entity's own units.

ConnectedAnchor

public Vector2 ConnectedAnchor

Where it holds the other, in its entity's own units, or in the world's where there is none.

UseMotor

public bool UseMotor

Whether the motor turns it.

MotorSpeed

public float MotorSpeed

How fast the motor turns this body against the other, in degrees a second, anticlockwise.

MaxMotorTorque

public float MaxMotorTorque

The most torque the motor turns it with, in newton meters.

UseLimits

public bool UseLimits

Whether it stops turning at HingeJoint2D.LowerAngle and HingeJoint2D.UpperAngle.

LowerAngle

public float LowerAngle

The least it turns, in degrees from where it was made: no further than a half turn either way, as Box2D measures a hinge's angle.

UpperAngle

public float UpperAngle

The most it turns, in degrees from where it was made: no further than a half turn either way.

BreakForce

public float BreakForce

The force it breaks at, in newtons; infinity never.

BreakTorque

public float BreakTorque

The torque it breaks at, in newton meters; infinity never.