I am creating a building mechanic for a 3d game. I have it set so a cube is Instantiate if the space key is pressed down while in building mode. It builds properly but I am unsure how to modify it so the player is unable to place a object down if one has already been placed in that location or it intersects with a object already in the level?
There are many ways you could do this.
A. Check the position of everysingle object in your scene and compare it to the position of a new object your trying to place if it matches with one of the objects its already placed (Don’t do this horribly inefficent)
B. Create a script so that when an object is placed it checks a bool isPlaced to true and doesn’t allow another object. This can be done in whatever script that you place the object with.