简体   繁体   中英

How can you switch between 1st and 3rd person camera using a Gameobject as a switch in Unity?

I am brand new to Unity 3D and have a basic scene with the "Skycar". I have made a loop the loop for the skycar to drive around but because of the steep angle, when the car is on the loop the 3rd person camera goes behind the object and you can't see the car anymore. Is there a way to, for example, code:

if car is on loop:
    switch to 1st person view
else:
    switch to 3rd person view

I know that that code isn't in any language but that is the sort of thing that I would like to do. Can anyone help?

Thanks.

Use some colliders that trigger when the car enters and leaves the loop. This way the camera will switch to third person when it hits the collider at the beginning of the loop and switch back to first person when it hits the collider at the end of the loop.

Colliders as triggers

使用此链接了解基本的第三人称相机实施,并且当您检测到您的汽车处于循环中时,您可以更改相机位置偏移到目标以更改视图。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM