#SystemSoftWareCrash camera blah blah thread
1 messages · Page 1 of 1 (latest)
no<
its
First Person Player
Main Camera
Cylinder
also these 2 should switch
x is up and down, and y is left and right in terms of rotation
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class MouseLook : MonoBehaviour
{
public float mouseSensitivity = 100f;
public Transform playerBody;
float xRotation = 0f;
void Start()
{
Cursor.lockState = CursorLockMode.Locked;
}
void Update()
{
float mouseX = Input.GetAxis("Mouse X") * mouseSensitivity * Time.deltaTime;
float mouseY = Input.GetAxis("Mouse Y") * mouseSensitivity * Time.deltaTime;
xRotation -= mouseY;
xRotation = Mathf.Clamp(xRotation, -90f, 90f);
transform.localRotation = Quaternion.Euler(xRotation, 0f, 0f);
playerBody.Rotate(Vector3.up * mouseX);
}
}
everything?
This is what i am using and it's working fine
literally the only relevant thing is the calling of a float
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class MouseLook : MonoBehaviour
{
public float mouseSensitivity = 100f;
public Transform playerBody;
float xRotation = 0f;
void Start()
{
Cursor.lockState = CursorLockMode.Locked;
}
void Update()
{
float mouseX = Input.GetAxis("Mouse X") * mouseSensitivity * Time.deltaTime;
float mouseY = Input.GetAxis("Mouse Y") * mouseSensitivity * Time.deltaTime;
xRotation -= mouseY;
xRotation = Mathf.Clamp(xRotation, -90f, 90f);
transform.localRotation = Quaternion.Euler(xRotation, 0f, 0f);
playerBody.Rotate(Vector3.up * mouseX);
}
}
``` There is a difference in our code
in all var
@analog hedge
Still rotating it wrong
Your not helpful (maybe because the vars are different)
just send the vars
you're literally rotating it on the wrong axis
Where?
I literally sent you the entire script
The camera is being rotated on the y axis and the player on the x axis
IT'S NOT A JOKE I LITERALLY SENT YOU THE ENTIRE SCRIPT
^
Rotate it on the right axes
helpful
It is, because i'm telling you what to do
Rotate the player on the y axis and the camera on the x axis
You're rotating them the opposite
pessimist
what
hmm
i'm literally telling you what to do????
helpful is a positive compliment
i literally said it is
ok?
xRotation -= mouseY;
xRotation = Mathf.Clamp(xRotation, -90f, 90f);
transform.localRotation = Quaternion.Euler(Vector3.up * mouseX);
playerBody.Rotate(xRotation, 0f, 0f);
The worst thing I ever did in my life is installing windows 11
...ok
transform.Rotate((Vector3.up * lookValue.x * mouseSensitivity) * Time.deltaTime);
xAngle += (-lookValue.y * mouseSensitivity) * Time.deltaTime;
xAngle = Mathf.Clamp(xAngle, -80, 80);
playerCamera.localRotation = Quaternion.Euler(xAngle, 0, 0);```
Same thing basically but different values and a mouse sensitivity variable
Assets\Player.cs(28,9): error CS0103: The name 'playerCamera' does not exist in the current context
I never said to just copy it, this is directly from my script
...also that script wasn't for you to just use instead.
playerBody
You asked to send the whole script to look at, so I did.
I asked for the vars
vars???
You want specifically the variable definitions or smth???
float xAngle = 0;
Vector2 movementValue = Vector2.zero;
public Transform playerCamera;
Rigidbody cc;
float posRotationPerc = 0;
float negRotationPerc = 0;
float zeroRotationPerc = 0;
InputAction jumpAction;
InputAction moveAction;
PlayerInput pi;
Vector2 lookValue = Vector2.zero;
public float mouseSensitivity = 3;
public float speed = 2;
Vector2 curMoveInput;
Vector2 moveDampVeloc;
float jumpQueue = 0;
float coyoteTime = 0;
bool doubleJumped = false;
public float jumpHeight = 2;