- Home /
Focus Vcam On Trigger
I have a virtual camera that activates when player collides with objects that has "house" tag and deactivates when OnTriggerExit. My problem is, i want this camera to automatically look at the collided object. Since its not a single object but a number of objects that has same tag, i don't know how to make vcam look at that one specific object when collided.
Answer by jtok4j · Feb 09, 2021 at 06:29 PM
Here is what you want.
You'll need to have a script which uses Transform.LookAt Here: https://docs.unity3d.com/ScriptReference/Transform.LookAt.html
This script should be on the Vcam.
(target) in the script needs to be the transform of your collided object.
Try it out and let us know if it succeeds. The demo script is rather helpful.
Keep on creating!
Justin of JustinTime Studio http://unity3d.expert
Your answer
![](https://koobas.hobune.stream/wayback/20220613024851im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
camera detect collision 2 Answers
move camera when it collides with a trigger 1 Answer
If trigger hit, spawn it 1 Answer
On trigger enter sometimes not working 4 Answers
Addforce to ball in camera position 0 Answers