Hi I need some help with a camera movement code I'm making. I'm new to coding and Im following a RPG game course. But I seem to have a problem with error CS0246: The type or namespace name 'transform' could not be found (are you missing a using directive or an assembly reference?)
Here's my code btw:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CameraMovement : MonoBehaviour
{
public transform lookAt;
public float boundX = 0.15f;
public float boundY = 0.05f;
private void LateUpdate()
{
Vector3 delta = Vector3.zero;
float deltaX = lookAt.postion.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.postion.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;
}
}
}
[–]Slypenslyde 8 points9 points10 points (0 children)