Check if items are overlapping

后端 未结 1 1271
故里飘歌
故里飘歌 2021-01-28 04:54

I have a few rooms which are placed randomly so I have to check if a room is overlapping. The rooms have a size of 10x10 and are for test reasons placed exactly side by side (th

1条回答
  •  广开言路
    2021-01-28 05:26

    I got it working now. Each OverlapBox was placed correctly, but they where still colliding, because they were 'too close' to the object. This change fixed it:

    if (Physics.OverlapBox(positions[i], new Vector3(sizes[i].x - 0.01f, sizes[i].y - 0.01f, sizes[i].z - 0.01f) / 2, rotations[i]).Length > 0)
    

    0 讨论(0)
提交回复
热议问题