
454 Views
207 Executions
Teleport 1 script
Universal Script 📌
Elu859037gmaiFirst script
1 year ago
Please login to perform these actions:Does it work?
No reports yetNo reports yet. Tried it? Be the first to say.
Also noticed:
Description
Eo eo
using UnityEngine;
[AddComponentMenu("Gameplay/NoclipController")]
public class NoclipController : MonoBehaviour
{
public float moveSpeed = 10f;
public float boostMultiplier = 3f;
public float mouseSensitivity = 2f;
public bool lockCursor = true;
float yaw = 0f;
float pitch = 0f;
void Start()
{
Vector3 angles = transform.eulerAngles;
yaw = angles.y;
pitch = angles.x;
if (lockCursor) Cursor.lockState = CursorLockMode.Locked;
}
void Update()
{
// Rotação com mouse
float mx = Input.GetAxis("Mouse X") * mouseSensitivity;
float my = -Input.GetAxis("Mouse Y") * mouseSensitivity;
yaw += mx;
pitch += my;
pitch = Mathf.Clamp(pitch, -89f, 89f);
transform.rotation = Quaternion.Euler(pitch, yaw, 0f);
// Movimento local
Vector3 input = new Vector3(Input.GetAxis("Horizontal"), 0, Input.GetAxis("Vertical"));
// vertical (subir/descer)
if (Input.GetKey(KeyCode.E)) input.y += 1f;
if (Input.GetKey(KeyCode.Q)) input.y -= 1f;
float speed = moveSpeed;
if (Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift)) speed *= boostMultiplier;
Comments
0Log in to join the conversation. Login
No comments yet. Be the first!







