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

Move camera to create a shape

Discussion in 'Vuforia' started by Cynni, Mar 15, 2018.

  1. Cynni

    Cynni

    Joined:
    Mar 19, 2015
    Posts:
    17
    Hi,

    I like to make something like this, where you have to move the camera in a certain position to make/complete the shape
    https://imgur.com/a/QFygE

    Is there a way to achieve this with vuforia?

    Thanks in advance
    Cynthia
     
  2. theolagendijk

    theolagendijk

    Joined:
    Nov 12, 2014
    Posts:
    117
    Hi Cynni / Cynthia,

    Yes, you can do something like this with Vuforia, but it's actually not relevant whether you use Vuforia ( or other AR tracking or no AR tracking at all). The trick is primarily in the content of your 3D game scene.
    For this type of experience you would have to start with the creation of the content that shows these shapes from certain viewpoints.

    Have fun!
     
    Vuforia-Strasza and Cynni like this.
  3. Cynni

    Cynni

    Joined:
    Mar 19, 2015
    Posts:
    17
    So how do I handle this? Making models with a shape on them (a texture?) which are connected only in a certain viewpoint, but how does the camera know those are connected?
     
  4. theolagendijk

    theolagendijk

    Joined:
    Nov 12, 2014
    Posts:
    117
    I assume you'll be working with a perspective camera. ( Since you suggested AR. ) I might be overlooking something here, I haven't implemented this before, but I would argue that you would simply have to figure out the properties of the camera ( position, orientation ) that create the "visual match". The check could be done mathematically but it's probably quicker to just do a visual inspection right from the Unity editor. Select a camera in your Hierarchy and you will see a camera preview in your Scene view. Play around with the camera position and orientation until you discover the right perspective on your 3D model. Write down the crucial values. The game logic is then simple ; check each frame whether the player manoeuvred the camera into the right perspective by checking whether the camera properties match those of the solution. If so ; congratulate the player on his win or whatever you want to happen here. You should probably allow some deviation from the "perfect" values to make success achievable.
     
    Last edited: Mar 26, 2018
    Vuforia-Strasza and Cynni like this.
  5. Cynni

    Cynni

    Joined:
    Mar 19, 2015
    Posts:
    17
    Thanks, I will try that, but can't it be done another way, because then I have to hard code all the positions, and if I make a bigger level that would take some time to that. I was thinking can I use the camera to raycast and check if 2 colliders are close to each other?
     
  6. theolagendijk

    theolagendijk

    Joined:
    Nov 12, 2014
    Posts:
    117
    Sounds like an even better solution. Give it a try!
     
    Cynni likes this.