Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

unity rotate object to match normal

function Update () {
var hit : RaycastHit;
Debug.DrawRay (transform.position, -transform.up * 200, Color.red);
if (Physics.Raycast (transform.position, -transform.up, hit, 200)){
        transform.up = hit.normal;
    }
}
Source by forum.unity.com #
 
PREVIOUS NEXT
Tagged: #unity #rotate #object #match #normal
ADD COMMENT
Topic
Name
6+2 =