Type Function Object Body Library physics.* Return value Numbers Revision Release 2026.3728 Keywords body, velocity, world point, linear velocity See also object:getLinearVelocityFromLocalPoint() object:getWorldVector() object:getLinearVelocity()
Returns the linear velocity of the point on the body that is located at the given world‑space coordinates. This is useful when you need to know the velocity of a specific point on a rotating body — the velocity there is a combination of the body’s linear velocity and its angular velocity.
object:getLinearVelocityFromWorldPoint( worldX, worldY )
Number. The x coordinate of the point in world space.
Number. The y coordinate of the point in world space.
Two numbers: the x and y components of the linear velocity at that world point, in pixels per second. If the body is absent, nil is returned for both.
-- Create a rectangle and add a physics body
local myRect = display.newRect( 150, 150, 80, 40 )
physics.addBody( myRect, "dynamic", { density = 1.0 } )
-- Give it some linear and angular velocity
myRect:setLinearVelocity( 50, 0 ) -- moving right
myRect.angularVelocity = 90 -- rotating clockwise (degrees per second)
-- Choose a world point away from the center (e.g., near the right edge)
local worldX, worldY = myRect.x + 40, myRect.y + 20
-- Get the velocity of that point
local vx, vy = myRect:getLinearVelocityFromWorldPoint( worldX, worldY )
if vx and vy then
print( "Velocity at world point (" .. worldX .. ", " .. worldY .. "): " .. vx .. ", " .. vy )
end