S: FollowFixedUpdate, Makes another Object follow this

FollowFixedUpdate can be used to create as example a quick and easy First Person Camera

Attach FollowFixedUpdate to the Player and Drag the Camera inside the Propertie in the Unity Inspector

FollowFixedUpdate.cs

				
					using UnityEngine;

public class FollowFixedUpdate : MonoBehaviour
{
    public Transform m_TargetFollow;

    void FixedUpdate()
    {
        transform.position = m_TargetFollow.position;
        transform.rotation = m_TargetFollow.rotation;
    }
}
				
			

There are a couple use cases for this Script that also can be extented very easily with additional functionalities or OffSet.

When this Script is attached to another GameObject you can Drag a Transform of another Object inside the Unity Inspector and the Dragged Transform will follow the Parent Object of FollowFixedUpdate around.

Happy Development <3

Leave a Reply

Your email address will not be published.