Placing objects in the world
We've done most of the groundwork for placing the objects in the world. We already have a method for detecting a plane and providing a visual indicator for the player, so they know what a suitable surface is and, more importantly, what isn't. Now we need to spawn an object when a player taps on the screen and there is a valid plane. To do this, we need to create a new script, as follows:
- Create a new script called
PlaceObjectOnPlane
:public class PlaceObjectOnPlane : MonoBehaviour { public GameObject ObjectToPlace; private FindPlane PlaneFinder; private PlaneData Plane = null; void Awake() { PlaneFinder = FindObjectOfType<FindPlane>(); } void LateUpdate() { &...