Velocity of another Game Object?

There seem to be a lot of guessing here, but what would help us understand the problem is if you shared how you’re trying to get the velocity.

We currently have two ways.

Old (not yet deprecated) API reference (physics)

local velocity = go.get(url, "linear_velocity")

If you have a valid url, you should be able to get the velocity of any collision object.

New api (box2d) API reference (b2d.body)

local body = b2d.get_body(url)
local velocity = b2d.body.get_linear_velocity(body)

It would be helpful to know which of the approaches you tried and the errors you received, to better understand the problem.

1 Like