I cannot fix the Main Camera I tired last night stay up 1am and now it’s just getting frustrating for past month as I am focus on this project, but stuck on it. The main camera distorts everything and I even get compiler errors had delete the checkpoint script. I did checkpoint script again of retyped it and failed ten more times. Hours on endless research, As I tried to create checkpoints of other ways that won’t work either. I don’t know what to do anymore. I am a noob at scripting in Unity, but not totally of a noob as I am somewhat experienced at scripting.
My list things to do is Fix the Main Camera, Checkpoints, fix animator, and DONE.
Where I found Checkpoints lastest one: Video: Unity 2D Game Development 11 : Creating Check Points - YouTube
What information you’ll need to know?
I’ve made a video
AND
The Main Camera Script:
Script Name: SmoothFollow.cs
using UnityEngine;
using System.Collections;
public class SmoothFollow : MonoBehaviour
{
public Transform target;
public float smoothDampTime = 0.2f;
[HideInInspector]
public new Transform transform;
public Vector3 cameraOffset;
public bool useFixedUpdate = false;
private CharacterController2D _playerController;
private Vector3 _smoothDampVelocity;
void Awake()
{
transform = gameObject.transform;
_playerController = target.GetComponent();
}
void LateUpdate()
{
if( !useFixedUpdate )
updateCameraPosition();
}
void FixedUpdate()
{
if( useFixedUpdate )
updateCameraPosition();
}
void updateCameraPosition()
{
if( _playerController == null )
{
transform.position = Vector3.SmoothDamp( transform.position, target.position - cameraOffset, ref _smoothDampVelocity, smoothDampTime );
return;
}
if( _playerController.velocity.x > 0 )
{
transform.position = Vector3.SmoothDamp( transform.position, target.position - cameraOffset, ref _smoothDampVelocity, smoothDampTime );
}
else
{
var leftOffset = cameraOffset;
leftOffset.x *= -1;
transform.position = Vector3.SmoothDamp( transform.position, target.position - leftOffset, ref _smoothDampVelocity, smoothDampTime );
}
}
}