Question by
WluMih · Aug 06, 2019 at 01:42 PM ·
camera-movementcamera follow
Problem with movement of camer
Code: using System.Collections; using UnityEngine;
public class kamera : MonoBehaviour { public Transform sphere;
void Update()
{
Rigidbody rigidbody = sphere.GetComponent<Rigidbody>();
Vector3 vector = new Vector3(0, 6f, -10f);
float velocity = rigidbody.velocity.sqrMagnitude;
vector = vector * (1f*velocity/50f);
Vector3 newPosition = sphere.position + vector;
transform.position = Vector3.Lerp(transform.position, newPosition, Time.deltaTime*2f);
transform.LookAt(sphere);
}
}
Issue: https://youtu.be/-2Efa264Ubw I want to camer to not move in to a ball and went the ball accelerates, camer go futher from it
Comment