Positioning a polygon body

function setup()
    local h = HEIGHT/15
    local w = WIDTH/10
    shipPoints = {
    ship = physics.body(POLYGON, unpack(shipPoints))
    ship.x = WIDTH/2
    ship.y = HEIGHT/2

function draw()
    background(0, 0, 0, 255)
    stroke(73, 255, 0, 255)
    local points = ship.points
            for j = 1,#points do
                a = points[j]
                b = points[(j % #points)+1]
                line(a.x, a.y, b.x, b.y)

Ok so I guess I’m asking this; how do ship. x and y and vec2 coordinates impact the location of my physics body? Also how would I make the bodies location changeable and use it’s location as a variable. Also if there are errors or dumb things in my code please lmk. Thanks everyone.

@bhob12 - your polygon points are centred on (0,0), but the centre position of your polygon is at (ship.x,ship.y)

So what you need to do is this

pushMatrix() --store current drawing settings before we mess with them
translate(ship.x,ship.y) --move (0,0) to be at the ship position
rotate(ship.angle) --rotate to the ship's current angle
--put your "for" loop in here to draw the points
popMatrix() --restore drawing settings

So you “translate” (move) the point (0,0) to (ship.x,ship.y), then you rotate to be at the same angle as the physics object, then you draw all your points centred on (0,0) [which is now (ship.x,ship.y)], then you reverse the rotation and translation (in case you have more things to draw)

Wonderful thanks.