Quantcast
Channel: Latest Questions by secondry2
Viewing all articles
Browse latest Browse all 28

There is no renderer attacked to main camera

$
0
0
Hi! ok, so im trying to detect if a gameobject is outside the view of the main camera of the character controller. Here is my script, it is attached to the enemy: var angel : Transform; var cam : GameObject; var target : Transform; function Start () { } function Update () { var rot = target.position - angel.position; var dist = Vector3.Distance(angel.position, target.position); rot.y = 0; if (cam.renderer.isVisible) { //do nothing } else { Debug.Log("Not looking"); } } Here is the actual error I get: ![alt text][1] Now, obviously I do have a renderer attached to my cam object, it is the main camera. This is driving me up the walls, any ideas? [1]: http://i.imgur.com/kqvCIpO.png+

Viewing all articles
Browse latest Browse all 28

Trending Articles



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