fix: center ground under chunks and align player spawn with chunk grid
checkpoint / checkpoint (push) Successful in 5m56s
checkpoint / checkpoint (push) Successful in 5m56s
This commit is contained in:
@@ -55,6 +55,12 @@ func _create_mesh_for_tile(tile_def: TileDef) -> void:
|
||||
multi_mesh.mesh = _make_unit_cube_mesh()
|
||||
multi_mesh.instance_count = count
|
||||
|
||||
var col_body: StaticBody3D = null
|
||||
if tile_def.solid:
|
||||
col_body = StaticBody3D.new()
|
||||
col_body.name = "collision_%d" % tile_def.id
|
||||
add_child(col_body)
|
||||
|
||||
var instance_idx := 0
|
||||
for z in range(tile_layer.depth):
|
||||
for y in range(tile_layer.height):
|
||||
@@ -66,6 +72,13 @@ func _create_mesh_for_tile(tile_def: TileDef) -> void:
|
||||
var xform := Transform3D(Basis(), world_pos)
|
||||
multi_mesh.set_instance_transform(instance_idx, xform)
|
||||
instance_idx += 1
|
||||
if col_body != null:
|
||||
var col_shape := CollisionShape3D.new()
|
||||
var box := BoxShape3D.new()
|
||||
box.size = Vector3(TILE_SIZE, TILE_SIZE, TILE_SIZE)
|
||||
col_shape.shape = box
|
||||
col_shape.position = world_pos
|
||||
col_body.add_child(col_shape)
|
||||
|
||||
var mesh_instance := MultiMeshInstance3D.new()
|
||||
mesh_instance.multimesh = multi_mesh
|
||||
|
||||
Reference in New Issue
Block a user