Search found 4 matches

by Ferreret
Sat Mar 17, 2018 10:17 am
Forum: Support and Development
Topic: Making a fixture with a polygon
Replies: 6
Views: 5021

Re: Making a fixture with a polygon

Thank you pgimeno. My code is working with triangles and squares (also with relative points), but if I do a polyline with more vertex it doesn't work. I don't know why. I can manage with triangles, but I would like to know why. Anyway, at the moment I can continue.
by Ferreret
Fri Mar 16, 2018 11:14 am
Forum: Support and Development
Topic: Making a fixture with a polygon
Replies: 6
Views: 5021

Re: Making a fixture with a polygon

Thank you for the response. This is now my code: function maps:makePointsPolyline(x, y, vertices) local points = {} for i,obj in pairs(vertices) do table.insert(points, obj.x - x) table.insert(points, obj.y - y) end return points end obj.x is the relative point and x is the point of the body. If I m...
by Ferreret
Thu Mar 15, 2018 10:28 pm
Forum: Support and Development
Topic: Making a fixture with a polygon
Replies: 6
Views: 5021

Re: Making a fixture with a polygon

The problem is probably that the points of the polygon are relative to the body they belong to. If you create a rectangle with only width and height, the centre will be that of the object and you won't see the problem. But if I print the point in the console I can see the same point as in Tiled. I ...
by Ferreret
Thu Mar 15, 2018 5:13 pm
Forum: Support and Development
Topic: Making a fixture with a polygon
Replies: 6
Views: 5021

Making a fixture with a polygon

Hi community, It's my first question here. I've looked for some topic similar to this but I haven't found anything. What I want to do is making a fixture for a polygon. First of all I've created a map with Tiled. Then I take the points in the polyline field of the object. But when I run the program,...