Quantcast
Channel: Answers by "Motionreactor"
Viewing all articles
Browse latest Browse all 32

Answer by Motionreactor

$
0
0

You can cast a ray in a specific direction like this:

var hit : RaycastHit;
var ray : Ray = Ray(gameObject.transform.position, Vector3.forward);
if(Physics.Raycast(ray, hit, 10))
{
    Debug.Log(hit.distance);
    Debug.DrawLine(ray.origin, hit.point);
}

Vector3.forward could be any Vector direction you wish.


Viewing all articles
Browse latest Browse all 32

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>