Hi there i have object “object1” rotating by Quaternion.Euler function and camera as a child of the “object1” littlebit behind (change in the inspector not in code)
Camera rotating according to object1 as i want(automaticly by unity) but i need to make camera transforming littlebit slower than “object1” like in flight sim. And the question is how can i get access to Unity functions added automaticlly when i make camera children of “object1”
it is even possible ?
I guess your point is to smooth the movement of the camera behind the object.
You could try with a lerping method or with this tutorial http://unity3d.com/learn/tutorials/projects/stealth/camera-movement.
Here is a quick example to try:
public Transform player;
void Start()
{
// define offset position
}
void LateUpdate()
{
Vector3 zOffset = player.forward * -5.0f;
Vector3 yOffset = Vector3.up * 2.0f
Vector3 offset = player.position + zOffset + yOffset;
transform.LookAt(player);
transform.position = Vector3.Lerp(transform.position, offset, 0.05f );
}
Try it as I am not sure 100%.