Hey community
I have a little question:
I have a weapon turret as the game object.
The player can turn his turret with two buttons.
Now I want my camera to do this turn too, but not to
do the same anytime, just get the rotation the turret got.
"
using UnityEngine;
using System.Collections;
using UnityEngine.SceneManagement;
public class CameraManager : MonoBehaviour {
public Vector3 offset = new Vector3(0,5,-5);
public Camera playerCamera;
// Use this for initialization
void Start () {
if (playerCamera == null) {
playerCamera = Camera.mainCamera;
}
}
// Update is called once per frame
void Update () {
playerCamera.transform.position = transform.position + offset;
// playerCamera.transform.Rotate(new Vector3(90, 0, 0));
// Here I want the playerCamera to get the rotation of the object the script is assigned.
// So instead of (90, 0, 0) I need the actual roration of the object. But I donβt know how.
}
}
"
I hope you can help me
Best Regards,
Toby