feat: add 3D world and drawShadow definition
This commit is contained in:
parent
2083374adc
commit
b882471c1d
1 changed files with 12 additions and 0 deletions
|
@ -59,6 +59,8 @@ function World:new(datas)
|
|||
self.shapes = Bump.newWorld(50)
|
||||
|
||||
self.camera = Camera(self, self.def.camera)
|
||||
self.type = self.def.type or "2D"
|
||||
self.drawShadow = (self.def.drawShadow == true)
|
||||
|
||||
World.super.new(self)
|
||||
|
||||
|
@ -125,6 +127,11 @@ function World:_load()
|
|||
print("loading objects...")
|
||||
self.map:loadObjects()
|
||||
end
|
||||
if (self.def.createCollisions ~= nil) then
|
||||
for _, collision in ipairs(self.def.createCollisions) do
|
||||
self:newCollision(collision.type, collision.position.x, collision.position.y, collision.position.z or 0, collision.dimensions.w, collision.dimensions.h, collision.dimensions.d or 1)
|
||||
end
|
||||
end
|
||||
self:onLoad()
|
||||
end
|
||||
|
||||
|
@ -283,6 +290,11 @@ function World:checkCollisionAtPoint(body, position, filter)
|
|||
return Vector3D(x, y, z or 0), cols, collNumber
|
||||
end
|
||||
|
||||
|
||||
function World:getBodiesInCube(x, y, z, w, h, d)
|
||||
return self.bodies:queryCube(x, y, z, w, h, d)
|
||||
end
|
||||
|
||||
-- Shape handling
|
||||
-- Handle shapes, which make know what object is visible or not
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue