Question by
JumpingCactus · Oct 15, 2015 at 01:11 AM ·
c#unity5look at
Is there a way to make a script activate when you look at an object?
And if this is possible, how would I go about doing this? Oh, and just in case it matters, I'm using the standard FPS Controller and its scripts that comes with Unity 5.
Comment
Answer by getyour411 · Oct 15, 2015 at 01:41 AM
You could simulate 'I looked at an object' via a Raycast; the are endless tuts and examples on Raycast.
Examine the raycast hit and if it's the right thing, use GetComponent and fire up the script.