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

Question

Discussion in 'Getting Started' started by TheMadTomato1209, May 17, 2020.

  1. TheMadTomato1209

    TheMadTomato1209

    Joined:
    May 7, 2020
    Posts:
    18
    Please, read until the end!
    I want to know if that is possible:
    In this picture to return "true" , because the gameObject is touching the ground completelly:
    faleex.png
    And this to return false, because the gameObject is not all the way on the ground:


    truerx.png
    I got an idea of placing a lot of empty objects on the bottom of the gameObject, which will make a check sphere, but i will have to make a ton of them and it is going to be a lot of work for nothing. I made the pictures in paint, thats why they are bad, but they are just for example.

    Im still beginner adn i dont know if that is even possible, so if it is, i will be glad if you give an advice!
     
  2. Vryken

    Vryken

    Joined:
    Jan 23, 2018
    Posts:
    2,106
    Generally, this can be done by creating raycast or collider trigger checks from the corners of the object, and detecting if each corner is colliding with the terrain, so you end up with something like this:
    Picture1.jpg
     
  3. TheMadTomato1209

    TheMadTomato1209

    Joined:
    May 7, 2020
    Posts:
    18
    Thank you, i will try!