SHOW:
|
|
- or go back to the newest paste.
1 | using UnityEngine; | |
2 | using System.Collections; | |
3 | ||
4 | public class NoCamRotation : MonoBehaviour | |
5 | { | |
6 | public Transform target; | |
7 | public float distance; | |
8 | //public Transform target; | |
9 | //public float speed; | |
10 | ||
11 | ||
12 | // Use this for initialization | |
13 | void Start () | |
14 | { | |
15 | ||
16 | } | |
17 | ||
18 | // Update is called once per frame | |
19 | void Update () | |
20 | { | |
21 | - | transform.position = new Vector3(target.position.x, target.position.y, target.position.z - distance); |
21 | + | // transform.position = new Vector3(target.position.x, target.position.y, target.position.z - distance); |
22 | - | /*Vector3 targetDir = target.position - transform.position; |
22 | + | |
23 | - | float step = speed * Time.deltaTime; |
23 | + | |
24 | - | Vector3 newDir = Vector3.RotateTowards(transform.forward, targetDir, step, 0.0F); |
24 | + |