Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using Cinemachine;
- /*
- Quick and rough prototype script to make the
- CinemachineOrbitalCamera rotate around the target.
- ⚠️ Not sure if that's the best way to do it tho.
- Please consider subscribing to my Unity tutorial channel:
- https://www.youtube.com/@AnzyYoutube
- */
- public class FilmOrbit : MonoBehaviour
- {
- [SerializeField]
- private float speed = 10f;
- private CinemachineOrbitalTransposer _orbitalCamera;
- private float _position;
- void Start()
- {
- var vcam = GetComponent<CinemachineVirtualCamera>();
- if (vcam != null)
- _orbitalCamera = vcam.GetCinemachineComponent<CinemachineOrbitalTransposer>();
- }
- void Update()
- {
- _position += (Time.deltaTime * speed) % 360;
- _orbitalCamera.m_XAxis.Value = _position;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment