The error's:
Assets/Scripts/camera_motor.cs(32,36): error CS1026: ) expected
Assets/Scripts/camera_motor.cs(32,57): error CS1002: ; expected
Assets/Scripts/camera_motor.cs(32,57): error CS1513: } expected
And this is my code:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class camera_motor : MonoBehaviour
{
public Transform lookAt;
public float boundX = 0.15f;
public float boundY = 0.05f;
private void LateUpdate()
{
Vector3 delta = Vector3.zero;
float deltaX = lookAt.position.x - transform.position.x;
if (deltaX > boundX || deltaX < -boundX)
{
if (transform.position.x < lookAt.position.x)
{
delta.x = deltaX - boundX;
}
} else
{
delta.x = deltaX + boundX;
}
float deltaY = lookAt.position.y - transform.position.y;
if (deltaY > boundY || deltaY < -boundY)
{
if (transform.position y < lookAt.position.y)
{
delta.y = deltaY - boundy;
}
} else
{
delta.y = deltaY + boundY;
}
transform.position += new Vector3(delta.x, deltaY, 0);
}
}
Hope someone can help
↧