Search Unity

How to Avoid Objects falling Off the Planes Detected by ARCore (Unity 2019)

Discussion in 'AR' started by pradyumnp508, Aug 20, 2020.

  1. pradyumnp508

    pradyumnp508

    Joined:
    Aug 9, 2020
    Posts:
    15
    Hello!
    I am working on an ARCore project, Where The user spawns the Playable character on any surface Detected by ARCore. After which It can Move and Jump freely in the Augmented World while Fighting Some enemies.

    I successfully implemented a movement controller for the Playable Character. However there is Mechanic that I need to implement, I.e to stop the player from falling down into virtual Abyss.

    I am using Plane Prefabs that Come which ARCore Package, and they are dynamic as they can change their shape and combine into a single plane as more and more planes are detected. I also have applied a plane collider on them to make them interact with my character.

    Basically, I want the user to be able to Jump between different Surfaces like Table Tops, Furniture, but I also don't want they to fall below the detected planes. Can someone show my any way to implement this mechanic?

    One Thing I have come up is that If the objects Velocity is more than a threshold (Which Ill have to determine by testing it), then re-spawn the object in its last position on plane. But I don't have a clear understanding of how shall I implement this mechanic?

    Thanks in Advance!
     
  2. freeschool

    freeschool

    Joined:
    Dec 17, 2014
    Posts:
    9
    1. Create a large plane object hidden.
    2. When the plane is detected from ARCore, enable the large plane object and place it with the same height of the plane from ARCore.
    3. When the lower plane is detected from ARCore, shift the large plane object to the lower plane.