Question by
samuelselner · Jan 22 at 09:18 PM ·
movement script
my code dont working and it say error CS0246, where is problem?
Code
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CharacterCo
ntrollerController : MonoBehaviour
{
public Transform camera;
public float cameraRotation;
public CharecterController controller;
// Start is called before the first frame update
void Start()
{
Cursor.lockState = CursorLockMode.Locked;
Cursor.visible = false;
}
// Update is called once per frame
void Update()
{
float mouseX = Input.GetAxis("Mouse X");
float mouseY = Input.GetAxis("Mouse Y");
cameraRotation -= mouseY;
camera.localRotation = Quaternion.Euler(cameraRotation, 0, 0);
transform.Rotate(Vector3.up * mouseX);
float movemntX = Input.GetAxis("Horizontal");
float movemntZ = Input.GetAxis("Vertical");
Vector3 movement = transform.right * movement + transform.forward * movemntZ;
controller.Move(movement);
}
}
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220613052024im_/https://answers.unity.com/themes/thub/images/avi.jpg)