Type PhysObj
PhysObj
Methods
| addAngleVelocity( angularVelocity ) | Adds the given angular velocity value to the current angular velocity. |
| applyForceCenter( force ) | Applies force to the centre of the physics object. |
| applyForceOffset( force, offset ) | Applies force to the physics object from the given offset position. |
| applyTorqueCenter( torque ) | Applies torque to the centre of the physics object. |
| enableCollisions( enable ) | Enables or disables collisions on the physics object. |
| enableDrag( enable ) | Enables or disables drag on the physics object. |
| enableGravity( enable ) | Enables or disables gravity on the physics object. |
| enableMotion( enable ) | Enables or disables motion on the physics object. |
| getAngleVelocity() | Returns the angular velocity of the physics object. |
| getAngles() | Returns the angles of the physics object. |
| getContents() | Returns the contents of the physics object. |
| getDamping() | Returns damping values on the physics object. |
| getEnergy() | Returns the kinetic energy of the physics object. |
| getEntity() | Returns the entity this physics object belongs to. |
| getInertia() | Returns the inertia of the physics object. |
| getInvInertia() | Returns 1 / the inertia of the physics object. |
| getInvMass() | Returns 1 / the physics object's mass. |
| getMass() | Returns the mass of the physics object. |
| getMassCenter() | Returns the mass centre of the physics object in local space. |
| getMaterial() | Returns the type of material the physics object represents, e.g "wood", "metal". |
| getPos() | Returns the position of the physics object. |
| getPositionMatrix() | Returns the physics object's world transform matrix. |
| getRotDamping() | Returns the rotation damping value of the physics object. |
| getSpeedDamping() | Returns the speed damping value of the physics object. |
| getStress() | Returns the stress being exerted on the physics object as a number value. |
| getSurfaceArea() | Returns the total surface area of the physics object in units^2. |
| getVelocity() | Returns the velocity of the physics object. |
| getVelocityAtPoint( point ) | Returns the velocity in the object's local space at a specific point. |
| getVolume() | Returns the total volume of the physics object in units^3. |
| isAsleep() | Returns whether the physics object is "sleeping", that is, not being simulated. |
| isCollisionEnabled() | Returns whether the physics object has collisions enabled. |
| isDragEnabled() | Returns whether the physics object has drag enabled. |
| isGravityEnabled() | Returns whether the physics object has gravity enabled. |
| isMotionEnabled() | Returns whether the physics object has motion enabled, i.e whether it is not frozen. |
| isMoveable() | Returns whether the physics object is moveable or not. |
| isPenetrating() | Returns whether the physics object is intersecting another or not. |
| isValid() | Returns whether the physics object is valid. |
| localToWorld( vec ) | Returns the input vector transformed from local space to world space. |
| setMass( mass ) | Sets the mass of the physics object. |
| setVelocity( velocity ) | Sets the linear velocity of the physics object. |
| worldToLocal( vec ) | Returns the input vector transformed from world space to local space. |
Methods
- PhysObj:addAngleVelocity( angularVelocity )
-
Adds the given angular velocity value to the current angular velocity. Each component applies the given magnitude to the entity's corresponding local axis, e.g. a value of Vector( 0, 0, 50 ) applies an angular velocity to rotate the entity around its up direction by 50 units/s.
Environment:
ServerParameters:
-
angularVelocity: The angular velocity to add.
-
- PhysObj:applyForceCenter( force )
-
Applies force to the centre of the physics object.
Environment:
ServerParameters:
-
force: Force vector to apply.
-
- PhysObj:applyForceOffset( force, offset )
-
Applies force to the physics object from the given offset position.
Environment:
ServerParameters:
-
force: Force vector to apply. -
offset: Position in world space to apply from.
-
- PhysObj:applyTorqueCenter( torque )
-
Applies torque to the centre of the physics object.
Environment:
ServerParameters:
-
torque: The torque vector (where the direction is in world space and the magnitude's units are kg * degrees / s).
-
- PhysObj:enableCollisions( enable )
-
Enables or disables collisions on the physics object.
Environment:
ServerParameters:
-
enable: Boolean flag whether to enable.
-
- PhysObj:enableDrag( enable )
-
Enables or disables drag on the physics object.
Environment:
ServerParameters:
-
enable: Boolean flag whether to enable.
-
- PhysObj:enableGravity( enable )
-
Enables or disables gravity on the physics object.
Environment:
ServerParameters:
-
enable: Boolean flag whether to enable.
-
- PhysObj:enableMotion( enable )
-
Enables or disables motion on the physics object.
Environment:
ServerParameters:
-
enable: Boolean flag whether to enable.
-
- PhysObj:getAngleVelocity()
-
Returns the angular velocity of the physics object.
Environment:
SharedReturn value:
(Vector)Angular velocity *VECTOR*. - PhysObj:getAngles()
-
Returns the angles of the physics object.
Environment:
SharedReturn value:
(Angle)Angle object. - PhysObj:getContents()
-
Returns the contents of the physics object.
Environment:
SharedReturn value:
(number)The contents flags applied to this physics object (see trace.CONTENTS_*). - PhysObj:getDamping()
-
Returns damping values on the physics object.
Environment:
SharedReturn value:
(number)Linear damping, angular damping. - PhysObj:getEnergy()
-
Returns the kinetic energy of the physics object.
Environment:
SharedReturn value:
(number)Kinetic energy value. - PhysObj:getEntity()
-
Returns the entity this physics object belongs to.
Environment:
SharedReturn value:
(Entity)The entity this physics object belongs to. - PhysObj:getInertia()
-
Returns the inertia of the physics object.
Environment:
SharedReturn value:
(Vector)Vector inertia. - PhysObj:getInvInertia()
-
Returns 1 / the inertia of the physics object.
Environment:
SharedReturn value:
(Vector)Inverse inertia vector. - PhysObj:getInvMass()
-
Returns 1 / the physics object's mass.
Environment:
SharedReturn value:
(number)Inverse mass. - PhysObj:getMass()
-
Returns the mass of the physics object.
Environment:
SharedReturn value:
(number)Mass value. - PhysObj:getMassCenter()
-
Returns the mass centre of the physics object in local space.
Environment:
SharedReturn value:
(Vector)Vector mass centre position in local space. - PhysObj:getMaterial()
-
Returns the type of material the physics object represents, e.g "wood", "metal".
Environment:
SharedReturn value:
(string)String material type. NOT the same as Entity:getMaterial(). - PhysObj:getPos()
-
Returns the position of the physics object.
Environment:
SharedReturn value:
(Vector)Position vector. - PhysObj:getPositionMatrix()
-
Returns the physics object's world transform matrix. The first 3 columns are a rotation matrix representing the physics object's angles, and the last column is its position.
Environment:
SharedReturn value:
(VMatrix)The physics object's world transform as a matrix. - PhysObj:getRotDamping()
-
Returns the rotation damping value of the physics object.
Environment:
SharedReturn value:
(number)Rotation damping value. - PhysObj:getSpeedDamping()
-
Returns the speed damping value of the physics object.
Environment:
SharedReturn value:
(number)Speed damping value. - PhysObj:getStress()
-
Returns the stress being exerted on the physics object as a number value.
Environment:
SharedReturn value:
(number)Stress value. - PhysObj:getSurfaceArea()
-
Returns the total surface area of the physics object in units^2.
Environment:
SharedReturn value:
(number)Surface area value. - PhysObj:getVelocity()
-
Returns the velocity of the physics object.
Environment:
SharedReturn value:
(Vector)Velocity vector. - PhysObj:getVelocityAtPoint( point )
-
Returns the velocity in the object's local space at a specific point.
Environment:
SharedParameters:
-
point: The point (in world space) to get the velocity at.
Return value:
(Vector)The velocity at the given point. -
- PhysObj:getVolume()
-
Returns the total volume of the physics object in units^3.
Environment:
SharedReturn value:
(number)Volume value. - PhysObj:isAsleep()
-
Returns whether the physics object is "sleeping", that is, not being simulated.
Environment:
SharedReturn value:
(boolean)True if sleeping, false otherwise. - PhysObj:isCollisionEnabled()
-
Returns whether the physics object has collisions enabled.
Environment:
SharedReturn value:
(boolean)True if collisions are enabled, false otherwise. - PhysObj:isDragEnabled()
-
Returns whether the physics object has drag enabled.
Environment:
SharedReturn value:
(boolean)True if drag is enabled, false otherwise. - PhysObj:isGravityEnabled()
-
Returns whether the physics object has gravity enabled.
Environment:
SharedReturn value:
(boolean)True if gravity is enabled, false otherwise. - PhysObj:isMotionEnabled()
-
Returns whether the physics object has motion enabled, i.e whether it is not frozen.
Environment:
SharedReturn value:
(boolean)True if motion is enabled, false otherwise. - PhysObj:isMoveable()
-
Returns whether the physics object is moveable or not.
Environment:
SharedReturn value:
(boolean)True if moveable, false otherwise. - PhysObj:isPenetrating()
-
Returns whether the physics object is intersecting another or not.
Environment:
SharedReturn value:
(boolean)True if intersecting, false otherwise. - PhysObj:isValid()
-
Returns whether the physics object is valid. Note that trying to use an invalid physics object will throw an error.
Environment:
SharedReturn value:
(boolean)True if the physics object is valid, false otherwise. - PhysObj:localToWorld( vec )
-
Returns the input vector transformed from local space to world space.
Environment:
SharedParameters:
-
vec:
Return value:
(Vector)Translated and rotated vector. -
- PhysObj:setMass( mass )
-
Sets the mass of the physics object. Mass cannot exceed 50,000.
Environment:
ServerParameters:
-
mass: The new mass to give the physics object, in kilograms.
-
- PhysObj:setVelocity( velocity )
-
Sets the linear velocity of the physics object.
Environment:
ServerParameters:
-
velocity: Velocity vector in world space.
-
- PhysObj:worldToLocal( vec )
-
Returns the input vector transformed from world space to local space.
Environment:
SharedParameters:
-
vec:
Return value:
(Vector)Translated and rotated vector. -