## Libraries.Game.Physics.PhysicsProperties2D Documentation

This class is a property holder for a 2D mass. This class is used internally by Item2D clas

*Inherits from: *Libraries.Language.Object

## Summary

### Variable Summary Table

Variables | Description |
---|---|

integer NON_RESPONSIVE | static obje |

integer RESPONSIVE | object governed by kinematics (meaning, the object is affected by linear velocity and angular velocity setting |

integer UNMOVABLE |

### Actions Summary Table

Actions | Description |
---|---|

ApplyAngularImpulse(number impulse) | This action applied an angular impulse to the object which will cause the object to have a sudden change in angular velocity. |

ApplyForce(Libraries.Compute.Vector2 force, Libraries.Compute.Vector2 point) | This action applies the force that you passed in to a point that you passed in. |

ApplyForceToCenter(Libraries.Compute.Vector2 force) | This action applies a force to the center pf mass of the object. |

ApplyLinearImpulse(Libraries.Compute.Vector2 impulse, Libraries.Compute.Vector2 point) | This action applies a linear impulse to the object at a specified point, which will lead to a sudden change in linear velocity of the object. |

ApplyTorque(number torque) | This action applies a torque to the center of mass of the object, which means this torque will only affect the angular velocity of the object but not the linear velocity of the object. |

AssignMass(number mass) | This action changes the mass of this property holder, this will not change the density of this property holder. |

CanRotate(boolean flag) | This action sets whether the 2D object attached to this property holder will be able to rotate or not. |

Compare(Libraries.Language.Object object) | This action compares two object hash codes and returns an integer. |

Copy() | This action allows another PhysicsProperties2D object to be assigned by the values stored inside the current PhysicsProperties2D object. |

Equals(Libraries.Language.Object object) | This action determines if two objects are equal based on their hash code values. |

FastMoving(boolean flag) | This action sets whether if the object attached to this property holder will be moving quickly. |

GetAngularDamping() | This action gets the angular damping inside this property holder. |

GetAngularVelocity() | This action returns the angular velocity of the 2D object. |

GetCollisionGroupFlag() | This action gets whether the object attached to this property holder will be inside a collision group. |

GetCollisionGroupIndex() | This action gets which collision group that this object will be in. |

GetDensity() | This action returns the density that is stored inside this property holder. |

GetForce() | This action gets the force that is stored in this object. |

GetFriction() | This action gets the friction that is stored inside this property holder. |

GetHashCode() | This action gets the hash code for an object. |

GetInertia() | This action returns the mass moment of inertia about the object's local origin (NOTE: not the mass moment of inertia about the object's center of mass). |

GetInverseInertia() | This action returns the reciprocal of the mass moment of inertia about the object's center of mass. |

GetInverseMass() | This action returns the reciprocal of the mass (1/mass) inside this property holder. |

GetItem() | This action returns the Item2D that is attached to this physical properties. |

GetLinearDamping() | This action gets the linear damping inside this property holder. |

GetLinearVelocity() | This action returns both the x and y components of the linear velocity as a 2D vector. |

GetMass() | This action returns the mass of the object. |

GetRawInertia() | This action returns the mass moment of inertia about the object's center of mass. |

GetResponsiveness() | This action returns how physics (linear velocity, angular velocity, force, torque) will affect the object. |

GetRestitution() | This action returns how much energy that this 3D object will loose after a collision. |

GetSleepTime() | This action gets how much time that the 2D object attached to this property holder will remain in its current position. |

GetTorque() | This action gets the torque that is stored inside this object. |

IsFastMoving() | This action tells you whether if this object will be moving quickly. |

IsRotationAllowed() | This action tells you if the 2D object attached to this property holder will be able to rotate. |

IsSimulated() | This action tells you if the object attached to this property holder is being simulated. |

IsSimulationRequired() | This action tells you whether if you need to move the object that is attached to this property holder. |

RequireSimulation(boolean flag) | This action sets whether if the object attached to this property holder will require its position to be moved. |

SetAngularDamping(number angularDamping) | This action sets the angular damping inside this property holder. |

SetAngularVelocity(number angularVelocity) | This action sets the angular velocity of the 2D object. |

SetCollisionGroupFlag(boolean flag) | This action sets whether the object attached to this property holder will be inside a collision group. |

SetCollisionGroupIndex(integer index) | This action sets which collision group that this object will be in. |

SetDensity(number density) | This action changes the density that is stored inside this property holder. |

SetForce(Libraries.Compute.Vector2 force) | This action sets the force that will be applied to the object. |

SetFriction(number friction) | This action sets the friction that is stored inside this property holder. |

SetInertia(number inertia) | This action sets the mass moment of inertia about the about the object's local origin. |

SetInverseInertia(number inverseInertia) | This action sets the reciprocal of the mass moment of inertia about the object's center of mass. |

SetInverseMass(number inverseMass) | This action sets the reciprocal of the mass (1/mass) inside this property holder without changing mass and density. |

SetItem(Libraries.Interface.Item2D item) | This action attaches a 2D item, which includes the shape, friction, restitution, positions, and others of a 2D object as a part of the properties that this 2D item has. |

SetLinearDamping(number linearDamping) | This action sets the linear damping inside this property holder. |

SetLinearVelocity(Libraries.Compute.Vector2 linearVelocity) | This action sets the linear velocity of the 2D object. |

SetLinearVelocityX(number linearVelocityX) | This action sets the x component of the linear velocity of the 2D object. |

SetLinearVelocityY(number linearVelocityY) | This action sets the y component of the linear velocity of the 2D object. |

SetMass(number mass) | This action sets the mass of the this property holder, which will also set the density if a 2D item has been attached to this property holder. |

SetResponsiveness(integer type) | This action sets how physics (linear velocity, angular velocity, force, torque) will affect the object. |

SetRestitution(number restitution) | This action sets how much energy that this 3D object will loose after a collision. |

SetSleepTime(number time) | This action sets how much time that the 2D object attached to this property holder will remain in its current position. |

SetTorque(number torque) | This action sets the torque that could potentially be applied to this object. |

Simulate(boolean flag) | This action will change the variables in this property holder based on whether simulation is required of the object that is attached to this property holder. |

## Actions Documentation

### ApplyAngularImpulse(number impulse)

This action applied an angular impulse to the object which will cause the object to have a sudden change in angular velocity.

#### Parameters

- number impulse: The magnitude of the angular impuls

### ApplyForce(Libraries.Compute.Vector2 force, Libraries.Compute.Vector2 point)

This action applies the force that you passed in to a point that you passed in.

#### Parameters

- Libraries.Compute.Vector2: The force in global coordinates that you want to apply.
- Libraries.Compute.Vector2: The point in the global coordinants that you want the force to be applied t

### ApplyForceToCenter(Libraries.Compute.Vector2 force)

This action applies a force to the center pf mass of the object.

#### Parameters

- Libraries.Compute.Vector2: The force in global coordinates that you want to appl

### ApplyLinearImpulse(Libraries.Compute.Vector2 impulse, Libraries.Compute.Vector2 point)

This action applies a linear impulse to the object at a specified point, which will lead to a sudden change in linear velocity of the object. This will also lead to a sudden change in angular velocity of the object if the linear impulse is not applied at the center of mass of the object.

#### Parameters

- Libraries.Compute.Vector2: The impulse vector in global coordinates that you want to apply to the object.
- Libraries.Compute.Vector2: The point in the global coordinants that you want the linear impulse to be applied t

### ApplyTorque(number torque)

This action applies a torque to the center of mass of the object, which means this torque will only affect the angular velocity of the object but not the linear velocity of the object.

#### Parameters

- number torque: The magnitude of torque to the center of mass of the objec

### AssignMass(number mass)

This action changes the mass of this property holder, this will not change the density of this property holder.

#### Parameters

- number mass: The mass of the objec

### CanRotate(boolean flag)

This action sets whether the 2D object attached to this property holder will be able to rotate or not.

#### Parameters

- boolean flag: True if this object can rotat

### 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 (smalle
```

#### Parameters

- Libraries.Language.Object: The object to compare to.

#### Return

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

### Copy()

This action allows another PhysicsProperties2D object to be assigned by the values stored inside the current PhysicsProperties2D object.

#### Return

Libraries.Game.Physics.PhysicsProperties2D: another PhysicsProperties2D that has the same value as the current PhysicsProperties2

### 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(
```

#### Parameters

- Libraries.Language.Object: The to be compared.

#### Return

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

### FastMoving(boolean flag)

This action sets whether if the object attached to this property holder will be moving quickly. If the object will be moving fast, then there will be more careful of a calculation of how this object collides with other objects.

#### Parameters

- boolean flag: True if this object will be moving quickl

### GetAngularDamping()

This action gets the angular damping inside this property holder.

#### Return

number:

### GetAngularVelocity()

This action returns the angular velocity of the 2D object.

#### Return

number: how fast the 2D object will rotat

### GetCollisionGroupFlag()

This action gets whether the object attached to this property holder will be inside a collision group.

#### Return

boolean: false if the object is not in a collision grou

### GetCollisionGroupIndex()

This action gets which collision group that this object will be in.

#### Return

integer: the collision group that this object will be i

### GetDensity()

This action returns the density that is stored inside this property holder.

#### Return

number: the density of the objec

### GetForce()

This action gets the force that is stored in this object.

#### Return

Libraries.Compute.Vector2: the force that will be applied to the objec

### GetFriction()

This action gets the friction that is stored inside this property holder.

#### Return

number: the coefficient of frictio

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

### GetInertia()

This action returns the mass moment of inertia about the object's local origin (NOTE: not the mass moment of inertia about the object's center of mass).

#### Return

number: the mass moment of inertia about the object's local origi

### GetInverseInertia()

This action returns the reciprocal of the mass moment of inertia about the object's center of mass.

#### Return

number: the reciprocal of the mass moment of inertia about the object's center of mas

### GetInverseMass()

This action returns the reciprocal of the mass (1/mass) inside this property holder.

#### Return

number: the (1/mass) valu

### GetItem()

This action returns the Item2D that is attached to this physical properties.

#### Return

Libraries.Interface.Item2D: the Item2D that is has this physical propertie

### GetLinearDamping()

This action gets the linear damping inside this property holder.

#### Return

number:

### GetLinearVelocity()

This action returns both the x and y components of the linear velocity as a 2D vector.

#### Return

Libraries.Compute.Vector2: the x and y components of the linear velocit

### GetMass()

This action returns the mass of the object.

#### Return

number: the mass of the objec

### GetRawInertia()

This action returns the mass moment of inertia about the object's center of mass.

#### Return

number: the mass moment of inertia about the object's center of mas

### GetResponsiveness()

This action returns how physics (linear velocity, angular velocity, force, torque) will affect the object. There are three possible values to be returned: 0 indicates that the object is UNMOVABLE, which means no matter what forces or torques is applied to the object, the object will not move. 1 indicates that the object is NON_RESPONSIVE, which means that only setting the angular velocity and linear velocity of this object will affect how the object behaves. 2 indicates that the object is REPONSIVE, which means that this object will behave differently when you apply forces and torques to this object.

#### Return

integer: Returns how physics will affect the objec

### GetRestitution()

This action returns how much energy that this 3D object will loose after a collision.

#### Return

number: the coefficient of restitutio

### GetSleepTime()

This action gets how much time that the 2D object attached to this property holder will remain in its current position.

#### Return

number: how much time that the 2D object attached to this property holder will remain in its current positio

### GetTorque()

This action gets the torque that is stored inside this object.

#### Return

number: torqu

### IsFastMoving()

This action tells you whether if this object will be moving quickly. If the object will be moving fast, then there will be more careful of a calculation of how this object collides with other objects.

#### Return

boolean: true if this object will be moving quickl

### IsRotationAllowed()

This action tells you if the 2D object attached to this property holder will be able to rotate.

#### Return

boolean: True if this object can rotat

### IsSimulated()

This action tells you if the object attached to this property holder is being simulated.

#### Return

boolean: True if you want to simulate the objec

### IsSimulationRequired()

This action tells you whether if you need to move the object that is attached to this property holder.

#### Return

boolean: true if will require its position to be move

### RequireSimulation(boolean flag)

This action sets whether if the object attached to this property holder will require its position to be moved.

#### Parameters

- boolean flag: True if will require its position to be move

### SetAngularDamping(number angularDamping)

This action sets the angular damping inside this property holder.

#### Parameters

- number angularDamping: The angular damping coefficien

### SetAngularVelocity(number angularVelocity)

This action sets the angular velocity of the 2D object.

#### Parameters

- number angularVelocity: How fast the 2D object will rotat

### SetCollisionGroupFlag(boolean flag)

This action sets whether the object attached to this property holder will be inside a collision group.

#### Parameters

- boolean flag: Whether the object attached to this property holder will be inside a collision grou

### SetCollisionGroupIndex(integer index)

This action sets which collision group that this object will be in.

#### Parameters

- integer index: The collision group that this object will be i

### SetDensity(number density)

This action changes the density that is stored inside this property holder. With the density changed, if there is a mass attached to this property holder, then the mass of the 2D object will also change based on the object's shape.

#### Parameters

- number density: The density of the objec

### SetForce(Libraries.Compute.Vector2 force)

This action sets the force that will be applied to the object. You only want to set a force on a RESPONSIVE 2D object (an object that will respond to forces). To actually apply a force, the type of the 2D object will be checked, therefore, it is not checked here. This action is useful to clear the forces to zero, not useful in setting a specific force that you want to apply to the object. To apply a force that you want to an object, use "ApplyForce(Vector2 force, Vector2 point)" or "ApplyForceToCenter(Vector2 force)".

#### Parameters

- Libraries.Compute.Vector2: The force that will be applied to the obje

### SetFriction(number friction)

This action sets the friction that is stored inside this property holder.

#### Parameters

- number friction: The coefficient of frictio

### SetInertia(number inertia)

This action sets the mass moment of inertia about the about the object's local origin.

#### Parameters

- number inertia: The mass moment of inertia about the object's local origi

### SetInverseInertia(number inverseInertia)

This action sets the reciprocal of the mass moment of inertia about the object's center of mass.

#### Parameters

- number inverseInertia: The reciprocal of the mass moment of inertia about the object's center of mas

### SetInverseMass(number inverseMass)

This action sets the reciprocal of the mass (1/mass) inside this property holder without changing mass and density.

#### Parameters

- number inverseMass: The (1/mass) valu

### SetItem(Libraries.Interface.Item2D item)

This action attaches a 2D item, which includes the shape, friction, restitution, positions, and others of a 2D object as a part of the properties that this 2D item has. This action is used internally in the Item2D class when you enable physics on the item when a "PhysicsProperties2D" property holder will be created so that Item2D will be attached to that property holder and the property holder will be attached to the Item2D.

#### Parameters

- Libraries.Interface.Item2D: The other Item2D to be copied fro

### SetLinearDamping(number linearDamping)

This action sets the linear damping inside this property holder.

#### Parameters

- number linearDamping: The linear damping coefficien

### SetLinearVelocity(Libraries.Compute.Vector2 linearVelocity)

This action sets the linear velocity of the 2D object.

#### Parameters

- Libraries.Compute.Vector2: The linear velocity of the 2D objec

### SetLinearVelocityX(number linearVelocityX)

This action sets the x component of the linear velocity of the 2D object.

#### Parameters

- number linearVelocityX: The x component of the linear velocity of the 2D objec

### SetLinearVelocityY(number linearVelocityY)

This action sets the y component of the linear velocity of the 2D object.

#### Parameters

- number linearVelocityY: The y component of the linear velocity of the 2D objec

### SetMass(number mass)

This action sets the mass of the this property holder, which will also set the density if a 2D item has been attached to this property holder.

#### Parameters

- number mass: The mass of the objec

### SetResponsiveness(integer type)

This action sets how physics (linear velocity, angular velocity, force, torque) will affect the object.

#### Parameters

- integer type: How physics will affect the objec

### SetRestitution(number restitution)

This action sets how much energy that this 3D object will loose after a collision. If you want the object to not loose any energy, then you can pass in 1.0. If you want the object to loose a lot of energy (meaning, they would probably move a lot slower after the collision), then you can pass in a 0.0. You can also use the values between 0 and 1.

#### Parameters

- number restitution: The coefficient of restitutio

### SetSleepTime(number time)

This action sets how much time that the 2D object attached to this property holder will remain in its current position.

#### Parameters

- number time: How much time that the 2D object attached to this property holder will remain in its current positio

### SetTorque(number torque)

This action sets the torque that could potentially be applied to this object.

#### Parameters

- number torque: The magnitude of torque that could potentially be applied to this object to rotate this objec

### Simulate(boolean flag)

This action will change the variables in this property holder based on whether simulation is required of the object that is attached to this property holder. If simulation is not required, then this means that the object's position will not change.

#### Parameters

- boolean flag: True if you want to simulate the objec