Libraries.Game.Physics.PhysicsProperties2D Documentation

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

Inherits from: Libraries.Language.Object

Summary

Variable Summary Table

VariablesDescription
integer NON_RESPONSIVEstatic obje
integer RESPONSIVEobject governed by kinematics (meaning, the object is affected by linear velocity and angular velocity setting
integer UNMOVABLEstatic obje

Actions Summary Table

ActionsDescription
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

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

ApplyForceToCenter(Libraries.Compute.Vector2 force)

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

Parameters

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

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

AssignMass(number mass)

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

Parameters

CanRotate(boolean flag)

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

Parameters

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)

Parameters

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

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)

Parameters

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

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

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

GetCollisionGroupIndex()

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

Return

integer: the collision group that this object will be in.

GetDensity()

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

Return

number: the density of the object.

GetForce()

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

Return

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

GetFriction()

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

Return

number: the 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.

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

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

GetInverseMass()

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

Return

number: the (1/mass) value.

GetItem()

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

Return

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

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

GetMass()

This action returns the mass of the object.

Return

number: the mass of the object.

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

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

GetRestitution()

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

Return

number: the coefficient of restitution.

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

GetTorque()

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

Return

number: torque.

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

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

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

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

RequireSimulation(boolean flag)

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

Parameters

SetAngularDamping(number angularDamping)

This action sets the angular damping inside this property holder.

Parameters

SetAngularVelocity(number angularVelocity)

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

Parameters

SetCollisionGroupFlag(boolean flag)

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

Parameters

SetCollisionGroupIndex(integer index)

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

Parameters

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

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

SetFriction(number friction)

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

Parameters

SetInertia(number inertia)

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

Parameters

SetInverseInertia(number inverseInertia)

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

Parameters

SetInverseMass(number inverseMass)

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

Parameters

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

SetLinearDamping(number linearDamping)

This action sets the linear damping inside this property holder.

Parameters

SetLinearVelocity(Libraries.Compute.Vector2 linearVelocity)

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

Parameters

SetLinearVelocityX(number linearVelocityX)

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

Parameters

SetLinearVelocityY(number linearVelocityY)

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

Parameters

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

SetResponsiveness(integer type)

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

Parameters

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

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

SetTorque(number torque)

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

Parameters

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