Mitra0000
Mitra0000

Reputation: 182

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.

Upvotes: 1

Views: 774

Answers (2)

Lund
Lund

Reputation: 272

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

Upvotes: 2

Umair M
Umair M

Reputation: 10720

Use This Link to learn about basic 3rd person camera implementation, and you can change offsets of camera position to your target to change your view when you detect that your car is in a loop.

Upvotes: 1

Related Questions