fix(physics): amelioration gestion coordonnées
This commit is contained in:
parent
de5cc096b8
commit
3bd966953d
2 changed files with 10 additions and 7 deletions
|
@ -80,13 +80,12 @@ function Actor:drawShadow()
|
||||||
if (self.world.type ~= "3D" and self.world.drawShadow ~= true) then
|
if (self.world.type ~= "3D" and self.world.drawShadow ~= true) then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
local shadowZ = self:getGroundZ()
|
if (self.zGround == nil) then
|
||||||
if (shadowZ == nil) then
|
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local r, g, b, a = love.graphics.getColor( )
|
local r, g, b, a = love.graphics.getColor( )
|
||||||
local x, y = self.position.x + (self.dimensions.w / 2), self.position.y + (3 * self.dimensions.h / 4) - shadowZ
|
local x, y = self.position.x + (self.dimensions.w / 2), self.position.y + (3 * self.dimensions.h / 4) - self.zGround
|
||||||
love.graphics.setColor(0, 0, 0, .3)
|
love.graphics.setColor(0, 0, 0, .3)
|
||||||
love.graphics.ellipse( "fill", math.floor(x), math.floor(y), self.dimensions.w / 2, self.dimensions.w / 4 )
|
love.graphics.ellipse( "fill", math.floor(x), math.floor(y), self.dimensions.w / 2, self.dimensions.w / 4 )
|
||||||
love.graphics.setColor(r, g, b, a)
|
love.graphics.setColor(r, g, b, a)
|
||||||
|
|
|
@ -141,6 +141,11 @@ function Physics:applyMovement(dt)
|
||||||
|
|
||||||
-- Les autres hitboxes traverses tout
|
-- Les autres hitboxes traverses tout
|
||||||
self:applyHitboxesCollisions(function(item, other) return "cross" end)
|
self:applyHitboxesCollisions(function(item, other) return "cross" end)
|
||||||
|
|
||||||
|
if (self.visual ~= nil) then
|
||||||
|
self:getGroundZ()
|
||||||
|
self.world:updateShape(self)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function Physics:move(position)
|
function Physics:move(position)
|
||||||
|
@ -148,9 +153,6 @@ function Physics:move(position)
|
||||||
if (self.isDestroyed == false) then
|
if (self.isDestroyed == false) then
|
||||||
self.position, cols, colNumber = self.mainHitbox:checkCollisionAtPoint(position, self.filter)
|
self.position, cols, colNumber = self.mainHitbox:checkCollisionAtPoint(position, self.filter)
|
||||||
self.mainHitbox:updatePosition()
|
self.mainHitbox:updatePosition()
|
||||||
if (self.visual ~= nil) then
|
|
||||||
self.world:updateShape(self)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
return self.position, cols, colNumber
|
return self.position, cols, colNumber
|
||||||
|
@ -202,7 +204,9 @@ function Physics:getGroundZ()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return z
|
if (z ~= nil) then
|
||||||
|
self.zGround = math.floor(z)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function Physics:_applyCollisionResponses(col)
|
function Physics:_applyCollisionResponses(col)
|
||||||
|
|
Loading…
Add table
Reference in a new issue