Im fairly new to DEFOLD. I am running into an error with the following code
function init(self)
local url = msg.url(nil, "go", "collisionobject")
local body = b2d.get_body(url)
b2d.body.get_linear_velocity_from_local_point(body, vmath.vector3(1, 1, 1))
end
and its returning the following error:
ERROR:SCRIPT: main/main.script:8: bad argument #1 to 'get_linear_velocity_from_local_point' (vector3 expected, got userdata)
stack traceback:
[C]:-1: in function get_linear_velocity_from_local_point
main/main.script:8: in function <main/main.script:1>
Thank you for the reply and help. It also occurs with get_linear_velocity_from_world_point. Should I post an issue on github. Whats the best way to document this error?
So in the mean time while this bug get fixed I think this bit of code should give you the same/similar results.
function get_world_point_velocity(point, body)
local angularVelocity = go.get(body, "angular_velocity")
local linearVelocity = go.get(body, "linear_velocity")
return linearVelocity + vmath.cross(angularVelocity, point - go.get_position(body))
end