Libraries.Game.Physics.PhysicsProperties3D Documentation

This class is a property holder for a 3D mass. This class is used internally by Item3D class.

Inherits from: Libraries.Language.Object

Variables Table

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

Actions Documentation

ApplyAngularImpulse(Libraries.Compute.Vector3 impulse)

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

Parameters

ApplyDamping(number seconds)

This action applies the scale factors that will decrease the linear and angular velocities that we calculated.

Parameters

  • number seconds: The amount of time in the future.

ApplyForce(Libraries.Compute.Vector3 force, Libraries.Compute.Vector3 point)

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

Parameters

ApplyForceToCenter(Libraries.Compute.Vector3 force)

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

Parameters

ApplyLinearImpulse(Libraries.Compute.Vector3 impulse, Libraries.Compute.Vector3 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

ApplyLinearImpulseToCenter(Libraries.Compute.Vector3 impulse)

This action applies an linear impulse to the center of mass of this object.

Parameters

ApplyTorque(Libraries.Compute.Vector3 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

CanRotate(boolean flag)

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

Parameters

  • boolean flag: True if this object can rotate.

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)

Copy()

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

Return

Libraries.Game.Physics.PhysicsProperties3D: the other PhysicsProperties3D to copy from.

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)

FastMoving(boolean flag)

This action sets whether if the object attached to this property holder will be moving fast. 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 quickly.

GetAngularDamping()

This action returns a number that will be used to decrease the angular velocity to ensure that our linear velocity calculation isn't too big.

Return

number: the angular damping.

GetAngularFactor()

This action returns a number that scales the torque applied to the 3D object. Having an angular factor less than 1 makes the object less sensitive to the torque applied to it.

Return

number: the angular factor.

GetAngularVelocity()

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

Return

Libraries.Compute.Vector3: how fast the 3D 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.

GetForce()

This action gets the force that is stored inside thie PhysicsProperties3D property holder.

Return

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

GetFriction()

This action returns a number that lets you know how smooth thhe surface of this object is.

Return

number: the coefficient of friction.

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()

GetInterpolatedAngularVelocity()

This action returns an approximation of angular velocity of the 3D object.

Return

Libraries.Compute.Vector3: an approximation of angular velocity of the 3D object.s

GetInterpolatedLinearVelocity()

This action returns an approximation of linear velocity of the 3D object.

Return

Libraries.Compute.Vector3: the approximation of linear velocity of the 3D object.

GetInverseInertiaLocal()

This action returns the inverse mass moment of inertia of the 3D object relative to the local origin of the 3D object, where the components of the inverse mass moment of inertia is just the reciprocal of the local mass moment of inertia.

Return

Libraries.Compute.Vector3: the inverse mass moment of inertia of the 3D object relative to the local origin of the 3D object.

GetInverseInertiaWorld()

This action returns the inertia tensor in global coordinates.

Return

Libraries.Compute.Matrix3: the inertia tensor in global coordinates.

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 Item3D that is attached to these physical properties.

Return

Libraries.Interface.Item3D: the Item3D that is attached to these physical properties.

GetLinearDamping()

This action returns a number that will be used to decrease the linear velocity to ensure that our linear velocity calculation isn't too big.

Return

number: linear damping.

GetLinearVelocity()

This action returns the linear velocity of the 3D object that is attached to this PhysicsProperties3D property holder.

Return

Libraries.Compute.Vector3: the linear velocity.

GetLinearVelocityAtLocalPoint(Libraries.Compute.Vector3 relativePosition)

This action lets you know the linear velocity of a point "Vector3 relativePosition" on this 3D object.

Parameters

Return

Libraries.Compute.Vector3: the linear velocity.

GetMass()

This action returns the mass of the object.

Return

number: the mass of the object.

GetPushVelocity()

This action returns the push velocity that is used in a Split Impulse solver.

Return

Libraries.Compute.Vector3: the push velocity that is used in a Split Impulse solver.

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 3D 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

Libraries.Compute.Vector3: torque.

GetTurnVelocity()

This action returns the turn velocity that is used in a Split Impulse solver.

Return

Libraries.Compute.Vector3: the turn velocity that is used in a Split Impulse solver.

IntegrateTransform(Libraries.Game.Collision.PhysicsPosition3D currentTransform, number seconds, Libraries.Game.Collision.PhysicsPosition3D predictedTransform)

This action calculates where the 3D object would be after a certain amount of time.

Parameters

IntegrateVelocities(number seconds)

This action estimates what the linear and angular velocities would be after a certain amount of time.

Parameters

  • number seconds: The amount of time in the future.

InternalApplyImpulse(Libraries.Compute.Vector3 linearComponent, Libraries.Compute.Vector3 angularComponent, number impulseMagnitude)

This action allows you to add linear velocity, "Vector3 linearComponent," and add angular velocity, "Vector3 angularComponent," both scaled by "number impulseMagnitude" to the current linear velocity and angular velocity of this 3D object.

Parameters

IsFastMoving()

This action tells you whether if this object will be moving fast. 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 3D 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

  • boolean flag: True if will require its position to be moved.

SaveKinematicState(number timeStep)

This action stores the angular, linear velocities of the 3D object before its angular and linear velocities are updated.

Parameters

  • number timeStep: The amount of time to simulate.

SetAngularDamping(number angularDamping)

This action sets a number that will be used to decrease the angular velocity to ensure that our linear velocity calculation isn't too big.

Parameters

  • number angularDamping: The angular damping.

SetAngularVelocity(Libraries.Compute.Vector3 angularVelocity)

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

Parameters

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

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

SetForce(Libraries.Compute.Vector3 force)

This action sets the force that will be applied to the object.

Parameters

SetFriction(number friction)

This action sets how smooth the surface of this object is. If the surface of this object is smooth, then you can pass in a number 0.0, if you want the surface of this object to be rough, then you can pass in a number 1.0.

Parameters

  • number friction: The coefficient of friction.

SetInterpolatedAngularVelocity(Libraries.Compute.Vector3 velocity)

This action stores an approximation of angular velocity of the 3D object.

Parameters

SetInterpolatedLinearVelocity(Libraries.Compute.Vector3 velocity)

This action stores an approximation of linear velocity of the 3D object.

Parameters

SetInverseInertiaLocal(Libraries.Compute.Vector3 inverseInertia)

This action sets the inverse mass moment of inertia of the 3D object relative to the local origin of the 3D object, where the components of the inverse mass moment of inertia is just the reciprocal of the local mass moment of inertia.

Parameters

  • Libraries.Compute.Vector3: the inverse mass moment of inertia of the 3D object relative to the local origin of the 3D object.

SetInverseMass(number inverseMass)

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

Parameters

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

SetItem(Libraries.Interface.Item3D item)

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

Parameters

SetLinearDamping(number linearDamping)

This action sets a number that will be used to decrease the linear velocity to ensure that our linear velocity calculation isn't too big.

Parameters

  • number linearDamping: the linear damping.

SetLinearVelocity(Libraries.Compute.Vector3 linearVelocity)

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

Parameters

SetLinearVelocityX(number linearVelocityX)

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

Parameters

  • number linearVelocityX: The x component of the linear velocity of the 3D object.

SetLinearVelocityY(number linearVelocityY)

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

Parameters

  • number linearVelocityY: The y component of the linear velocity of the 3D object.

SetLinearVelocityZ(number linearVelocityZ)

This action sets the z component of the linear velocity of the 3D object.

Parameters

  • number linearVelocityZ: The z component of the linear velocity of the 3D object.

SetMass(number mass)

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

Parameters

  • number mass: The mass of the object.

SetMassProperties(number mass, Libraries.Compute.Vector3 inertia)

This action updates the mass of the 3D object and the inertia of the 3D object relative to the local origin.

Parameters

SetResponsiveness(integer type)

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

Parameters

  • integer type: The responsiveness of the object.

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

SetSleepTime(number time)

This action sets how much time that the 3D 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 position.

SetTorque(Libraries.Compute.Vector3 torque)

This action sets the torque that could potentially be applied to the center of mass of 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

  • boolean flag: True if you want to simulate the object.

UpdateInertia(Libraries.Compute.Matrix3 basis)

This action recalculates the mass moment of inertia relative to the world axis.

Parameters