horizontall camera movement around the object

Updated on July 8, 2018 in [A] Unity Scripting
Share on Facebook0Tweet about this on TwitterShare on Google+0Share on Reddit0
0 on July 8, 2018

Hello,

I am making my first game and I have got a problem. I want camera to move horizontally in two directios around an object by pushing the screen left or right with a mouse, I hope you understand what i am trying to say (PHOTO: https://imgur.com/a/hLNWG4b)

I used this script to make camera move:

  1. using UnityEngine;
  2. using System.Collections;
  3. public class CameraClass : MonoBehaviour {
  4.  
  5.     public GameObject target;
  6.     private float speedMod = 10.0f;
  7.     private Vector3 point;
  8.  
  9.     void Start () {
  10.         point = target.transform.position;//get target’s coords
  11.         transform.LookAt(point);//makes the camera look to it
  12.     }
  13.  
  14.     void Update () 
  15.         transform.RotateAround (target.transform.positionVector3.up, speedMod * Time.deltaTime);  
  16.     }
  17. }

I hope you can help me, sorry for my English.

Vabalas.

  • Liked by
Reply