## Libraries.Game.Physics.CollisionVelocityConstraint Documentation

This class is used internally by CollisionSolver2D to record the information that will help solve the velocity constraint.

Inherits from: Libraries.Language.Object

## Summary

### Actions Summary Table

ActionsDescription
Compare(Libraries.Language.Object object)This action compares two object hash codes and returns an integer.
Equals(Libraries.Language.Object object)This action determines if two objects are equal based on their hash code values.
GetCollisionIndex()This action returns the index on an array of LocalCollisionPoints2D that is associated with this CollisionVelocityConstraint.
GetFriction()This action returns the friction between the two objects.
GetHashCode()This action gets the hash code for an object.
GetIndexA()This action returns the group index of object A.
GetIndexB()This action returns the group index of object B.
GetInverseInertiaA()This action returns (1/mass moment of inertia of A).
GetInverseInertiaB()This action returns (1/mass moment of inertia of B).
GetInverseMassA()This action returns (1/massA).
GetInverseMassB()This action returns (1/massB).
GetInverseNormalMass()This action returns a table of values that represents the inverse properties of the 2D object that we can derive from the mass and shape of the 2D object.
GetNormal()This action returns the normal of collision.
GetNormalMass()This action returns a table of values that represents the properties of the 2D object that we can derive from the mass and shape of the 2D object.
GetPointCount()This action returns the number of velocity constraint points.
GetPoints()This action returns all of the velocity constraint points.
GetRestitution()This action returns the restitution between the two objects.
GetTangentSpeed()This action returns the relative speeds of the point of collision between the two objects a time step prior to the current time step.
InitializeInverseNormalMass()This action initializes a table of values that represents the inverse properties of the 2D object that we can derive from the mass and shape of the 2D object.
InitializeNormalMass()This action initializes a table of values that represents the properties of the 2D object that we can derive from the mass and shape of the 2D object.
SetCollisionIndex(integer index)This action sets the index on an array of LocalCollisionPoints2D that is associated with this CollisionVelocityConstraint.
SetFriction(number friction)This action sets the friction between the two objects.
SetIndexA(integer index)This action sets the group index of object A.
SetIndexB(integer index)This action sets the group index of object B.
SetInverseInertiaA(number inverseInertia)This action sets (1/mass moment of inertia of A).
SetInverseInertiaB(number inverseInertia)This action sets (1/mass moment of inertia of B).
SetInverseMassA(number inverseMass)This action sets (1/massA).
SetInverseMassB(number inverseMass)This action sets (1/massB).
SetNormal(Libraries.Compute.Vector2 normal)This action sets the normal of collision.
SetPointCount(integer pointCount)This action sets the number of velocity constraint points.
SetRestitution(number restitution)This action sets the restitution between the two objects.
SetTangentSpeed(number tangentSpeed)This action sets the relative speeds of the point of collision in the current time step.

## 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.

Example Code

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

#### Return

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

### Equals(Libraries.Language.Object object)

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

Example Code

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

#### Return

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

### GetCollisionIndex()

This action returns the index on an array of LocalCollisionPoints2D that is associated with this CollisionVelocityConstraint. This is used by the CollisionSolver2D class.

#### Return

integer: the index of interest.

### GetFriction()

This action returns the friction between the two objects.

#### Return

number: coefficient of friction.

### GetHashCode()

This action gets the hash code for an object.

Example Code

``````Object o
integer hash = o:GetHashCode()``````

#### Return

integer: The integer hash code of the object.

### GetIndexA()

This action returns the group index of object A.

#### Return

integer: the group index of object A.

### GetIndexB()

This action returns the group index of object B.

#### Return

integer: the group index of object B.

### GetInverseInertiaA()

This action returns (1/mass moment of inertia of A).

#### Return

number: the (1/mass moment of inertia of A) value.

### GetInverseInertiaB()

This action returns (1/mass moment of inertia of B).

#### Return

number: (1/mass moment of inertia of B) value.

### GetInverseMassA()

This action returns (1/massA).

#### Return

number: (1/massA).

### GetInverseMassB()

This action returns (1/massB).

#### Return

number: the (1/massB) value.

### GetInverseNormalMass()

This action returns a table of values that represents the inverse properties of the 2D object that we can derive from the mass and shape of the 2D object.

#### Return

Libraries.Containers.Table: a table of inverse normal masses.

### GetNormal()

This action returns the normal of collision.

#### Return

Libraries.Compute.Vector2: a vector representing the normal direction of collision.

### GetNormalMass()

This action returns a table of values that represents the properties of the 2D object that we can derive from the mass and shape of the 2D object.

#### Return

Libraries.Containers.Table: a table of normal masses.

### GetPointCount()

This action returns the number of velocity constraint points.

#### Return

integer: the number of velocity constraint points.

### GetPoints()

This action returns all of the velocity constraint points.

#### Return

Libraries.Containers.Array: an array containing velocity constraint points.

### GetRestitution()

This action returns the restitution between the two objects.

#### Return

number: coefficient of restitution.

### GetTangentSpeed()

This action returns the relative speeds of the point of collision between the two objects a time step prior to the current time step.

#### Return

number: the old tangent speed.

### InitializeInverseNormalMass()

This action initializes a table of values that represents the inverse properties of the 2D object that we can derive from the mass and shape of the 2D object.

### InitializeNormalMass()

This action initializes a table of values that represents the properties of the 2D object that we can derive from the mass and shape of the 2D object.

### SetCollisionIndex(integer index)

This action sets the index on an array of LocalCollisionPoints2D that is associated with this CollisionVelocityConstraint. This is used by the CollisionSolver2D class.

#### Parameters

• integer index: The index of interest.

### SetFriction(number friction)

This action sets the friction between the two objects.

#### Parameters

• number friction: The coefficient of friction.

### SetIndexA(integer index)

This action sets the group index of object A.

#### Parameters

• integer index: The group index of object A.

### SetIndexB(integer index)

This action sets the group index of object B.

#### Parameters

• integer index: The group index of object B.

### SetInverseInertiaA(number inverseInertia)

This action sets (1/mass moment of inertia of A).

#### Parameters

• number inverseInertia: The (1/mass moment of inertia of A) value.

### SetInverseInertiaB(number inverseInertia)

This action sets (1/mass moment of inertia of B).

#### Parameters

• number inverseInertia: The (1/mass moment of inertia of B) value.

### SetInverseMassA(number inverseMass)

This action sets (1/massA).

#### Parameters

• number inverseMass: The (1/massA) value.

### SetInverseMassB(number inverseMass)

This action sets (1/massB).

#### Parameters

• number inverseMass: The (1/massB) value.

### SetNormal(Libraries.Compute.Vector2 normal)

This action sets the normal of collision.

### SetPointCount(integer pointCount)

This action sets the number of velocity constraint points.

#### Parameters

• integer pointCount: The number of velocity constraint points.

### SetRestitution(number restitution)

This action sets the restitution between the two objects.

#### Parameters

• number restitution: The coefficient of restitution.

### SetTangentSpeed(number tangentSpeed)

This action sets the relative speeds of the point of collision in the current time step.

#### Parameters

• number tangentSpeed: The current tangent speed.