Skip to content

Commit d591fc1

Browse files
committed
Make GetPrefabAt use Vector3
1 parent 56ddb3f commit d591fc1

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

Runtime/Code/VoxelWorld/VoxelWorld.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ public List<GameObject> GetChildGameObjects() {
368368
return children;
369369
}
370370

371-
public GameObject GetPrefabAt(Vector3Int pos) {
371+
public GameObject GetPrefabAt(Vector3 pos) {
372372
Vector3Int chunkKey = WorldPosToChunkKey(pos);
373373
chunks.TryGetValue(chunkKey, out Chunk chunk);
374374
if (chunk == null) {

Runtime/Code/VoxelWorld/VoxelWorldChunk.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,11 +149,11 @@ private int CountAirVoxelsAround(VoxelWorld world, Vector3Int checkPos) {
149149
return count;
150150
}
151151

152-
public GameObject GetPrefabAt(Vector3Int worldPos) {
152+
public GameObject GetPrefabAt(Vector3 worldPos) {
153153
if (prefabObjects == null) {
154154
return null;
155155
}
156-
Vector3Int localKey = WorldPosToLocalPos(worldPos);
156+
Vector3Int localKey = WorldPosToLocalPos(Vector3Int.FloorToInt(worldPos));
157157

158158
if (prefabObjects.TryGetValue(localKey, out var prefab)) {
159159
return prefab.Item1;

0 commit comments

Comments
 (0)