- Home /
Duplicate Question
How to check if there is space for instantiation ?
Hello, Im instantiating objects on mouseklick, they are of different sizes and I want to find an efficient way to check if there is enough space to instantiate one of them, without colliding or overlapping with those which are already in the scene.
Thanks for your suggestions :)
This questions has been covered numerous times on Unity Answers. The two most common solutions are to 1) use Physics.CheckSphere() or Physics.OverlapSphere() or 2) to go ahead and place the item but keep it invisible for a frame and check for a collision. There are other ways, but they take advantage of properties of the objects being placed and/or properties of the area of placement (and you've not spelled out either one).
Follow this Question
Related Questions
Character controller will not move through 3D space. 0 Answers
Mouse Movement (Tracking) 1 Answer
3D spaceship control using mouse? 0 Answers
Can't shoot towards mouse click point 0 Answers