Search Unity

Align object to surface below it?

Discussion in 'Scripting' started by Warrior1424, Oct 11, 2013.

  1. Warrior1424

    Warrior1424

    Joined:
    Sep 30, 2010
    Posts:
    980
    How would I raycast down, take the hit normal, and position an object so it sits flat on the normal?
    Example, if my object is above a plane at 45 degrees, my object rotates along it's X-axis so it too is turned 45 degrees.
    Hope this makes sense.

    JS I preferred, but I can figure it out from CS code if needed.
     
    Last edited: Oct 11, 2013
  2. Marsupilami

    Marsupilami

    Joined:
    Sep 22, 2013
    Posts:
    21
unityunity