PhysicsApplyVelocity

From Multi Theft Auto: Wiki
Revision as of 11:32, 14 February 2020 by CrosRoad95 (talk | contribs) (Created page with "__NOTOC__ {{Client function}} Applies velocity to rigid body ==Syntax== <syntaxhighlight lang="lua"> bool ohysicsApplyVelocity( physics-rigid-body theRigidBody, float veloc...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Applies velocity to rigid body

Syntax

bool ohysicsApplyVelocity( physics-rigid-body theRigidBody, float velocityX, float velocityY, float velocityZ [, float relativeX, float relativeY, float relativeZ ] )             

Required Arguments

  • theRigidBody: rigid body you want to apply velocity
  • velocityXYZ: velocity you wants to apply
  • relativeXYZ: relative position, default: 0,0,0

Returns

True if velocity got applied, false otherwise.

Example

Doing box flip

local box = physicsCreateShape(physics, "box", 1)
local function spawnTestBox(x,y,z)
  local boxrb = physicsCreateRigidBody(box)
  physicsSetProperties(boxrb, "position", x,y,z)
  return boxrb;
end

local notATable = spawnTestBox(0,0,5)
setTimer(function()
  physicsApplyVelocity(notATable , 0,0,10, 0,1,0)
end,500,1) -- let box land on the ground.

See Also