- Home /
Look at Object
Hey Guys,
Just wondering if any of you clever people knew where I would begin with this one!
I want my player to interact with items and doors which I can do, but I want it only to happen when I am looking at it. You know what I mean? Where do I start?
Thanks
Answer by Talas21 · Feb 26, 2012 at 11:29 AM
You should look into raycasting http://unity3d.com/support/documentation/ScriptReference/Collider.Raycast.html
If you use the default "First Person Controller" or a camera tagged "MainCamera" there is the possibility to automatically limit the raycasting on one axis, in your case the z one, making the door open only when you're close enough and looking at it.
Your answer
Follow this Question
Related Questions
Toggling visibility of two gameobjects. 2 Answers
How to make player go through an object or obstacle and but can't go back 1 Answer
Having a particle effect stick to player 0 Answers
Play a sound when i look at a certain object? 1 Answer
Can i add texture to multiple layers of player? and how? 0 Answers