Hi I want to dynamically use b2.PolygonShape passing in a list of values. The API has a set function that is a list of coordinates. This is fine for static entry of coordinates but how do pass an array of coordinates. I want to be able to do something like:
local coords = {10,0, 0,10, 100,110, 110,120, 120,110, 10,10, 0,10}
local shape = b2.PolygonShape.new()
shape:set(coords)
Comments
You can use shape:set(unpack(coords))
http://pgl.yoyo.org/luai/i/unpack
Likes: ___