thats just sad
DannyKong6
Creator of
Recent community posts
inform me if the code doesn't work, I just want to help you with some code, I Aswell am not looking for a team, but I thought maybe I could try to help, I'm not the best at coding so prob won't work but I gave it a try for u so here is the code for a player first person controller.
using UnityEngine;
[RequireComponent(typeof(CharacterController))]
public class FirstPersonController : MonoBehaviour
{
public float movementSpeed = 5.0f;
public float lookSpeed = 2.0f;
public float lookXLimit = 45.0f;
public float jumpSpeed = 8.0f;
public float gravity = 20.0f;
private CharacterController characterController;
private Vector3 moveDirection = Vector3.zero;
private float rotationX = 0;
void Start()
{
characterController = GetComponent<CharacterController>();
Cursor.lockState = CursorLockMode.Locked;
Cursor.visible = false;
}
void Update()
{
if (characterController.isGrounded)
{
Vector3 forward = transform.TransformDirection(Vector3.forward);
Vector3 right = transform.TransformDirection(Vector3.right);
float curSpeedX = movementSpeed * Input.GetAxis("Vertical");
float curSpeedY = movementSpeed * Input.GetAxis("Horizontal");
moveDirection = (forward * curSpeedX) + (right * curSpeedY);
if (Input.GetButton("Jump"))
{
moveDirection.y = jumpSpeed;
}
}
moveDirection.y -= gravity * Time.deltaTime;
characterController.Move(moveDirection * Time.deltaTime);
rotationX += -Input.GetAxis("Mouse Y") * lookSpeed;
rotationX = Mathf.Clamp(rotationX, -lookXLimit, lookXLimit);
Camera.main.transform.localRotation = Quaternion.Euler(rotationX, 0, 0);
transform.rotation *= Quaternion.Euler(0, Input.GetAxis("Mouse X") * lookSpeed, 0);
if (Input.GetKeyDown(KeyCode.Escape))
{
Cursor.lockState = CursorLockMode.None;
Cursor.visible = true;
}
}
}