Skip to content

Commit 7743411

Browse files
1 parent 35b17dd commit 7743411

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

Assets/Scripts/GameManager.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public override void OnAwake()
2525
ImageLoader.LoadTexture(AssetsPaths.ASSETS + "Textures\\TextureAtlasBig2.png");
2626
Kernel.Instance.Context.CreateShader(AssetsPaths.ASSETS + "Shaders\\VoxelShader");
2727

28-
if (false)
28+
if (true)
2929
{
3030
var controller = Entity.Manager.CreateCamera(name: "Controller").Entity;
3131
controller.Transform.SetPosition(y: 200);

Assets/Scripts/Gameplay/PlayerController.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,8 @@ private bool IsCollidingAtPosition(Vector3 position)
222222
Vector3Int voxelPosition = new Vector3Int(x, y, z);
223223
Generator.GetChunkFromPosition(voxelPosition, out var chunk, out var localVoxelPosition);
224224

225-
if (chunk != null && chunk.IsVoxelSolid(localVoxelPosition))
225+
if (chunk is not null && chunk.SolidVoxelData is not null)
226+
if(chunk.IsVoxelSolid(localVoxelPosition))
226227
// Collision detected
227228
return true;
228229
}

Assets/Scripts/Gameplay/RayCaster.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,9 @@ private bool IsVoxelSolid(Vector3Int voxelPosition)
141141
// Retrieve the voxel at the given position
142142
Generator.GetChunkFromPosition(voxelPosition, out var chunk, out var localVoxelPosition);
143143

144-
if (chunk is not null && chunk.IsVoxelSolid(localVoxelPosition))
145-
return true;
144+
if (chunk is not null && chunk.SolidVoxelData is not null)
145+
if (chunk.IsVoxelSolid(localVoxelPosition))
146+
return true;
146147

147148
return false;
148149
}

0 commit comments

Comments
 (0)