Ein bisschen rumgeeiert
This commit is contained in:
36
3d Prototyp/Assets/Scripts/CameraScript.cs
Normal file
36
3d Prototyp/Assets/Scripts/CameraScript.cs
Normal file
@ -0,0 +1,36 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class CameraScript : MonoBehaviour
|
||||
{
|
||||
[SerializeField]
|
||||
private Character _character;
|
||||
|
||||
[SerializeField]
|
||||
private Camera _camera;
|
||||
|
||||
public float Distance = 5.0f;
|
||||
|
||||
void Start()
|
||||
{
|
||||
Vector4 position = new Vector4(0, 0, -Distance, 1.0f);
|
||||
|
||||
Matrix4x4 mat = Matrix4x4.Rotate(Quaternion.Euler(45, 0, 0));
|
||||
|
||||
_camera.transform.localPosition = mat * position;
|
||||
transform.position = _character.transform.position;
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
transform.position = _character.transform.position;
|
||||
}
|
||||
|
||||
private void OnValidate()
|
||||
{
|
||||
Start();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user