#rotation problem

1 messages · Page 1 of 1 (latest)

deep ether
#

so

#

public gameobject camera

#

float xrot -= rotationY

#

:)

#

yes

#

do that

#

it should work?

#

waiit

#

try doing

#
public float xrot

xrot -= rotationY;

#

declate xrot first

#

that will work

#

ya

#

will work

#

lemme send the variables

#

public float sensitivity;

public GameObject cam;

private float xrot;
#

float mouseX = Input.GetAxis("Mouse X") * sensitivity;
float mouseY = Input.GetAxis("Mouse Y") * sensitivity;

    xrot -= mouseY;

    xrot = Mathf.Clamp(xrot, -90f, 90f);

    cam.transform.localRotation = Quaternion.Euler(xrot, 0f, 0f);

    transform.Rotate(Vector3.up * mouseX);
#

just paste everythin

#

delete variables

#

or make a new script

#

WHERES UPDATE

#

make a new script

#

yes

#

paste it

#

dude you gotta learn unity basics first

#

MAKE A SENSITIVITY FLOAT

#

show ur full code

#

paste it

#

paste ur code here

#

ty

#
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Rotate : MonoBehaviour
{

    public float sensitivity;

    public GameObject cam;

    private float xrot;
    
    // Start is called before the first frame update
    void Start()
    {
        
    }

    // Update is called once per frame
    void Update()
    {
float mouseX = Input.GetAxis("Mouse X") * sensitivity;
    float mouseY = Input.GetAxis("Mouse Y") * sensitivity;

        xrot -= mouseY;

        xrot = Mathf.Clamp(xrot, -90f, 90f);

        cam.transform.localRotation = Quaternion.Euler(xrot, 0f, 0f);

        transform.Rotate(Vector3.up * mouseX);

    }
}

#

should work

#

wat

#

can u screenshare

#

call me now