|
how to touch off a event when the centre of camrea look at a gameobject?
(comments are locked)
|
|
I think that best way to do taht is to use raycasting. Raycast script reference: http://unity3d.com/support/documentation/ScriptReference/Physics.Raycast.html Use ScreenToWorldPoint function to get the center of the camera. Your argument for ScreenToWorldPoint should be Vector3(Screen.width/2, Screen.heigh/2, camera.nearClipPlane). ScreenToWorldPoint script reference: http://unity3d.com/support/documentation/ScriptReference/Camera.ScreenToWorldPoint.html Example: (Attach it to an object that has a camera component)
p.s. I didn't test this code ;)
(comments are locked)
|
