diff --git a/framework/scenes/world/actors/init.lua b/framework/scenes/world/actors/init.lua index 194868c..093b1cc 100644 --- a/framework/scenes/world/actors/init.lua +++ b/framework/scenes/world/actors/init.lua @@ -80,13 +80,12 @@ function Actor:drawShadow() if (self.world.type ~= "3D" and self.world.drawShadow ~= true) then return end - local shadowZ = self:getGroundZ() - if (shadowZ == nil) then + if (self.zGround == nil) then return end 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.ellipse( "fill", math.floor(x), math.floor(y), self.dimensions.w / 2, self.dimensions.w / 4 ) love.graphics.setColor(r, g, b, a) diff --git a/framework/scenes/world/actors/physics/init.lua b/framework/scenes/world/actors/physics/init.lua index bbb5391..e5e2f70 100644 --- a/framework/scenes/world/actors/physics/init.lua +++ b/framework/scenes/world/actors/physics/init.lua @@ -141,6 +141,11 @@ function Physics:applyMovement(dt) -- Les autres hitboxes traverses tout self:applyHitboxesCollisions(function(item, other) return "cross" end) + + if (self.visual ~= nil) then + self:getGroundZ() + self.world:updateShape(self) + end end function Physics:move(position) @@ -148,9 +153,6 @@ function Physics:move(position) if (self.isDestroyed == false) then self.position, cols, colNumber = self.mainHitbox:checkCollisionAtPoint(position, self.filter) self.mainHitbox:updatePosition() - if (self.visual ~= nil) then - self.world:updateShape(self) - end end return self.position, cols, colNumber @@ -202,7 +204,9 @@ function Physics:getGroundZ() end end end - return z + if (z ~= nil) then + self.zGround = math.floor(z) + end end function Physics:_applyCollisionResponses(col)