Search Unity

  1. If you have experience with import & exporting custom (.unitypackage) packages, please help complete a survey (open until May 15, 2024).
    Dismiss Notice
  2. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice

How can i make a camera rotate automatically after a while around a object

Discussion in 'Editor & General Support' started by Rachzella, Sep 13, 2019.

  1. Rachzella

    Rachzella

    Joined:
    Oct 9, 2015
    Posts:
    78
    Hello coders, I have a simple question.
    I have been playing this game recently and i wanted to have the camera mechanics much like it, as it's well done, useful. and looks great. The camera system i'm talking about is the garage camera in CSR 2, if you don't know what it is i'll explain. When you are in the garage. the camera is set to the car. and can't move in different position then rotating around it. From up to down till the floor coliders, and the top view. and left to right around the vehicle. the camera starts roltating automatically after 30 seconds of inactivity. but you can also use the touch screen to roltate it. i wanted to do this myself. but i didn't get the camera to work with it. Does anyone know how i can make this?
     
  2. Rachzella

    Rachzella

    Joined:
    Oct 9, 2015
    Posts:
    78
    Forgot to add the detials. This is currently how it works.
    https://i.imgur.com/vtdeg7m.mp4 it rotates around the car. but i can't use the touch screen or mouse to move the camera. and it starts to imidiately rotate.
    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4.  
    5. public class CameraRotate : MonoBehaviour
    6. {
    7.    public float speed;
    8.  
    9.    void Update (){
    10.        transform.Rotate(0, speed * Time.deltaTime, 0);
    11.    }
    12. }
    13.