Physics component handles object physics.
Physics.mass
Physics.width
Physics.height
Physics.bounciness
Physics.velocity
Physics.static
Physics.colliderType
Physics.friction
Returns the mass of the Physics object
local myMass = self.gameObject.physics:GetMass()
Sets the mass of the Physics object to the given value
mass
- number
(required) the mass to set to
self.gameObject.physics:SetMass(5)
Returns the width of the Physics object
local myWidth = self.gameObject.physics:GetWidth()
Sets the width of the Physics object
width
- number
(required) the width to set to
self.gameObject.physics:SetWidth(10)
Returns the height of the Physics object
local myHeight = self.gameObject.physics:GetHeight()
Sets the height of the Physics object
height
- number
(required) the height to set to
self.gameObject.physics:SetHeight(10)
Returns the bounciness value of the Physics object
local myBounciness = self.gameObject.physics:GetBounciness()
Sets the bounciness of the Physics object to the given value
bounciness
- number
(required) the bounciness to set to
self.gameObject.physics:SetBounciness(.5)
Returns the velocity vector of the object
local myVelocity = self.gameObject.physics:GetVelocity()
Sets the velocity of the Physics object to the given vector
velocity
- Vector3
(required) the velocity to set to
self.gameObject.physics:SetVelocity(Vector3:New(2, 1, 0))
Returns whether or not the Physics object is static
local isStatic = self.gameObject.physics:IsStatic()
Sets whether or not the Physics object is static
static
- bool
(required) true to set to static, false for non-static
self.gameObject.physics:SetStatic(false)
Returns the collider type of the object
local myCollider = self.gameObject.physics:GetColliderType()
Sets the collider type of the Physics object to the value
type
- string
(required) the collider type to set to
self.gameObject.physics:SetColliderType('CIRCLE')
Returns the friction coefficient of the object
local myFrictionCoefficient = self.gameObject.physics:GetFriction()
Sets the friction coefficient of the Physics object to the given value. This should be a value between 0 and 1
type
- number
(required) the friction coefficient to set to
self.gameObject.physics:SetFriction(.5)
Applies an impulse to the Physics object according to the given vector
impulse
- Vector3
(required) the impulse vector to apply
self.gameObject.physics:ApplyImpulse(Vector3:New(0, 1, 0))