#SystemSoftWareCrash camera blah blah thread

1 messages · Page 1 of 1 (latest)

analog hedge
#

asdf

#

@rich bluff Send an image of the player in the hirearchy

analog hedge
#

wh

#

????

rich bluff
#

First Person Player
Main Camera
Cylinder

analog hedge
#

also these 2 should switch

#

x is up and down, and y is left and right in terms of rotation

rich bluff
#
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);
    }
}
analog hedge
#

The player should rotate on y

#

the camera on x

rich bluff
#

now I just tilt

#

Transform is camera

#

@analog hedge

analog hedge
rich bluff
analog hedge
rich bluff
#

can you send everything

#

(it looks like a little is missing)

analog hedge
analog hedge
rich bluff
# analog hedge 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

rich bluff
#

just send the vars

analog hedge
analog hedge
analog hedge
rich bluff
#

very funny

#

so wtf should I do

analog hedge
analog hedge
rich bluff
#

helpful

analog hedge
#

Rotate the player on the y axis and the camera on the x axis

#

You're rotating them the opposite

rich bluff
analog hedge
rich bluff
analog hedge
#

i'm literally telling you what to do????

rich bluff
analog hedge
rich bluff
analog hedge
#
xRotation -= mouseY;
        xRotation = Mathf.Clamp(xRotation, -90f, 90f);
            
        transform.localRotation = Quaternion.Euler(Vector3.up * mouseX);
        playerBody.Rotate(xRotation, 0f, 0f);
rich bluff
#

The worst thing I ever did in my life is installing windows 11

analog hedge
#

...ok

rich bluff
#

Funny

#

it doesent work

analog hedge
#
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
rich bluff
analog hedge
#

...also that script wasn't for you to just use instead.

rich bluff
#

playerBody

analog hedge
#

You asked to send the whole script to look at, so I did.

rich bluff
analog hedge
#

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;
rich bluff
#

better

#

Funny that unity didnt change the saves