I’ve got a system in place that generates a series of blocks but I’m having trouble with them overlapping each other. I need to find a way to check if an object is already in the space that the block is intending to occupy before it is generated. Any help at all would be appreciated.
Put in a collider that is a trigger. if that doesn’t trigger anything you are golden. And you can add your real object. Use the onTriggerEnter method.
How should I be implementing these colliders? Attach them to an empty gameobject and spawn them in the position the real gameobject should spawn in? I'm not entirely sure how to go about doing this. Should colliders just be attached to the real gameobjects once they spawn? Objects can be generated north, east, south and west from a starting object and then from any subsequent objects if this helps you visualise the situation at all.
If your objects have a collider attached to it, you can SphereCast from a certain height above spawn point and check whether you are hitting any of your other objects. if you are hitting do not spawn (choose another point to spawn) or spawn.
How should I be implementing these colliders? Attach them to an empty gameobject and spawn them in the position the real gameobject should spawn in? I'm not entirely sure how to go about doing this. Should colliders just be attached to the real gameobjects once they spawn? Objects can be generated north, east, south and west from a starting object and then from any subsequent objects if this helps you visualise the situation at all.
– kylehlogan