Libraries.Game.Physics.Joints.WeldJoint2D Documentation

This class contains information for a joint that makes two objects to be attached to each other.

Inherits from: Libraries.Language.Object, Libraries.Game.Physics.Joints.Joint2D

Actions Documentation

Compare(Libraries.Language.Object object)

This action compares two object hash codes and returns an integer. The result is larger if this hash code is larger than the object passed as a parameter, smaller, or equal. In this case, -1 means smaller, 0 means equal, and 1 means larger. This action was changed in Quorum 7 to return an integer, instead of a CompareResult object, because the previous implementation was causing efficiency issues.

Parameters

Return

integer: The Compare result, Smaller, Equal, or Larger.

Example

Object o
Object t
integer result = o:Compare(t) //1 (larger), 0 (equal), or -1 (smaller)

Equals(Libraries.Language.Object object)

This action determines if two objects are equal based on their hash code values.

Parameters

Return

boolean: True if the hash codes are equal and false if they are not equal.

Example

use Libraries.Language.Object
use Libraries.Language.Types.Text
Object o
Text t
boolean result = o:Equals(t)

GetAnchorA()

This action returns the point that the two objects are attached together in world coordinates.

Return

Libraries.Compute.Vector2: anchor point in global coordinates.

GetAnchorB()

This action returns the point that the two objects are attached together in world coordinates.

Return

Libraries.Compute.Vector2: anchor point in global coordinates.

GetCollideConnected()

This action returns whether the connected joints can collide or not.

Return

boolean: whether the connected joints can collide or not.

GetDampingRatio()

This action returns a number that tells you how fast the two objects that are joined with the WeldJoint2D will stop oscillating.

Return

number: the damping ratio.

GetEdgeA()

This action returns the first JointEdge2D stored inside this Joint2D.

Return

Libraries.Game.Physics.Joints.JointEdge2D: the first JointEdge2D stored inside this Joint2D.

GetEdgeB()

This action returns the second JointEdge2D stored inside this Joint2D.

Return

Libraries.Game.Physics.Joints.JointEdge2D: the second JointEdge2D stored inside this Joint2D.

GetFrequency()

This action returns how fast the two objects will oscillate relative to each other because of this joint.

Return

number: frequency.

GetHashCode()

This action gets the hash code for an object.

Return

integer: The integer hash code of the object.

Example

Object o
integer hash = o:GetHashCode()

GetItemA()

This action returns the first 2D item that is joined by this Joint2D.

Return

Libraries.Interface.Item2D: the first 2D item that is joined by this Joint2D.

GetItemB()

This action returns the second 2D item that is joined by this Joint2D.

Return

Libraries.Interface.Item2D: the second 2D item that is joined by this Joint2D.

GetLocalAnchorA()

This action returns where the second object will be attached to the first object seen from the perspective of the first object.

Return

Libraries.Compute.Vector2: where the second object will be attached to the first object seen from the perspective of the first object.

GetLocalAnchorB()

This action returns where the first object will be attached to the second object seen from the perspective of the second object.

Return

Libraries.Compute.Vector2: where the first object will be attached to the second object seen from the perspective of the second object.

GetNext()

This action gets you the next information about a joint (stored in another Joint2D) inside a linked list of Joint2Ds.

Return

Libraries.Game.Physics.Joints.Joint2D: the next joint.

GetPrevious()

This action gets you the previous information about a joint (stored in another Joint2D) inside a linked list of Joint2Ds.

Return

Libraries.Game.Physics.Joints.Joint2D: the previous joint.

GetReactionForce(number inverseTimeStep)

This action returns the amount of force that is exerted on the two items joined together because of the joint constraints.

Parameters

  • number inverseTimeStep: The reciprocal of the inverse of the time step.

Return

Libraries.Compute.Vector2: the reaction force.

GetReactionTorque(number inverseTimeStep)

This action returns the amount of torque that is exerted on the two items joined together because of the joint constraints.

Parameters

  • number inverseTimeStep: The reciprocal of the inverse of the time step.

Return

number: the reaction torque.

GetReferenceAngle()

This action returns the angle difference between object B and object A.

Return

number: the angle difference between object B and object A.

GetState()

This action returns whether this joint is INACTIVE, AT_LOWER, AT_UPPER, or EQUAL.

Return

integer: the state of the joint.

GetType()

This action returns the type of joint that you have.

Return

integer: the type of joint that you have.

InCollisionGroup()

This action returns whether the items in this joint is in a collision group with other items.

Return

boolean: true if the items in this joint is in a collision group with other items.

Initialize(Libraries.Interface.Item2D itemA, Libraries.Interface.Item2D itemB, Libraries.Compute.Vector2 anchor)

This action stores the variables passed in inside this WeldJoint2D.

Parameters

InitializeVelocityConstraints(Libraries.Game.Physics.Joints.JointSolverData2D data)

This action sends in velocity constraints to a JointSolverData2D so that a joint solver can solve for the limitations that this joint has exerted on the two objects.

Parameters

SetCollideConnected(boolean collide)

This action sets whether the connected joints can collide or not.

Parameters

  • boolean collide: Whether the connected joints can collide or not.

SetDampingRatio(number ratio)

This action sets a number that tells you how fast the two objects that are joined with the WeldJoint2D will stop oscillating.

Parameters

  • number ratio: The damping ratio, range: [0 (oscillate forever), 1 (no oscillation at all)].

SetEdgeA(Libraries.Game.Physics.Joints.JointEdge2D edgeA)

This action sets the first JointEdge2D stored inside this Joint2D.

Parameters

SetEdgeB(Libraries.Game.Physics.Joints.JointEdge2D edgeB)

This action sets the second JointEdge2D stored inside this Joint2D.

Parameters

SetFrequency(number hz)

This action sets how fast the two objects will oscillate relative to each other because of this joint.

Parameters

  • number hz: Frequency in Hertz.

SetInCollisionGroup(boolean flag)

This action sets whether the items in this joint is in a collision group with other items.

Parameters

  • boolean flag: Whether the items in this joint is in a collision group with other items.

SetItemA(Libraries.Interface.Item2D item)

This action sets the first 2D item that is joined by this Joint2D.

Parameters

SetItemB(Libraries.Interface.Item2D item)

This action sets the second 2D item that is joined by this Joint2D.

Parameters

SetLocalAnchorA(Libraries.Compute.Vector2 anchor)

This action sets where the second object will be attached to the first object seen from the perspective of the first object.

Parameters

  • Libraries.Compute.Vector2: Where the second object will be attached to the first object seen from the perspective of the first object.

SetLocalAnchorB(Libraries.Compute.Vector2 anchor)

This action sets where the first object will be attached to the second object seen from the perspective of the second object.

Parameters

  • Libraries.Compute.Vector2: Where the first object will be attached to the second object seen from the perspective of the second object.

SetNext(Libraries.Game.Physics.Joints.Joint2D next)

This action lets you store another information about a joint (stored in another Joint2D) as a next link to the current Joint2D.

Parameters

SetPrevious(Libraries.Game.Physics.Joints.Joint2D previous)

This action lets you store another information about a joint (stored in another Joint2D) as a previous link to the current Joint2D.

Parameters

SetReferenceAngle(number angle)

This action sets the angle difference between object B and object A.

Parameters

  • number angle: The angle difference between object B and object A.

SetState(integer newState)

This action sets whether this joint is INACTIVE, AT_LOWER, AT_UPPER, or EQUAL.

Parameters

  • integer newState: The state of the joint.

SetType(integer type)

This action sets the type of joint that you have.

Parameters

  • integer type: The type of joint that you have.

SolvePositionConstraints(Libraries.Game.Physics.Joints.JointSolverData2D data)

This action makes sure that the position constraints on the two items are met.

Parameters

Return

boolean: if the position constraints has been met through this solver.

SolveVelocityConstraints(Libraries.Game.Physics.Joints.JointSolverData2D data)

This action makes sure that the velocity constraints on the two items joined together are met.

Parameters