Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

How do i create temporary sphere collider inside script?

Discussion in 'Scripting' started by Epic-Username, Sep 8, 2015.

  1. Epic-Username

    Epic-Username

    Joined:
    May 24, 2015
    Posts:
    339
    How do i create something like:
    Random.insideUnitSphere
    except where it just acts as a collider and returns the object it hits?
     
  2. dworm

    dworm

    Joined:
    Jun 17, 2015
    Posts:
    74
  3. martinmr

    martinmr

    Joined:
    Mar 25, 2015
    Posts:
    325
    Random.insideUnitSphere gives you a Random point inside a Sphere with radius 1

    you can't use this for a collision system.

    depending on what you want to collide you can calculate if it hits or not by yourself
     
  4. Epic-Username

    Epic-Username

    Joined:
    May 24, 2015
    Posts:
    339
  5. Epic-Username

    Epic-Username

    Joined:
    May 24, 2015
    Posts:
    339
    Yeah i know that it gets a random point that's why i asked if there's another similar method except that returns a collider it hits. but thanks for your help anyway.