Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Instantiate Object on Plane Without Touch

Discussion in 'AR' started by mathe-matician, May 12, 2020.

  1. mathe-matician

    mathe-matician

    Joined:
    Jan 28, 2019
    Posts:
    2
    Hello - how would I go about instantiating a GameObject on a plane? E.g. When the app starts an enemy spawns on whatever plane is in front of you.

    I figure that I could use a Ray from the ARRaycastManager, but I can't figure out how to create a ray from the AR Camera to a plane and spawn the object. There are many tutorials on how to use a the raycast manager's Raycast method with a touch input, but I want the object to spawn automatically.

    I've also found the method MakeContentAppearAt(Transform, Vector3) for the ARSessionOrigin, but I can't figure out how to get the parameters for this method.

    I realize this is probably my lack of understanding of C# as well, but any help/direction would be appreciated!
     
    chgeorgiadis likes this.