Quantcast
Channel: Answers by "diegzumillo"
Viewing all articles
Browse latest Browse all 87

Answer by diegzumillo

$
0
0
Before positining the camera do a raycast call, and if it hits something position the camera a little before this point. A schematic view of this code: var distance : float; //distance of camera from the player var hit : raycasthit = Physics.Raycast (transform.position, -transform.forward, hit,distance); if (hit) //this gets executed if the raycast hits something Reposition camera using hit.point as a position. else Reposition camera using var distance as position. Reorient camera (using lookAt or something like that)

Viewing all articles
Browse latest Browse all 87

Trending Articles



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