Code: Select all
local t =0
for n = 1,8 do
local x,y =0
x=(self.width/2)*math.cos(t*math.pi)
y=(self.height/2)*math.sin(t*math.pi)
self.dots[n]={}
self.dots[n].x=self.body:getX()-x
self.dots[n].y=self.body:getY()-y
t=t+0.25
end
Code: Select all
self.shape = love.physics.newPolygonShape(self.body ,self.dots[1].x,self.dots[1].y , self.dots[2].x,self.dots[2].y , self.dots[3].x,self.dots[3].y , self.dots[4].x,self.dots[4].y ,self.dots[5].x,self.dots[5].y , self.dots[6].x,self.dots[6].y , self.dots[7].x,self.dots[7].y , self.dots[8].x,self.dots[8].y)
i got just clear screen when draw it. Nothing displayed. Set back for example self.shape =love.physics.newRectangleShape(self.body , 0, 0, self.width , self.height) - it render normal
Draw function
Code: Select all
love.graphics.polygon("line", self.shape:getPoints())