my quartenion is not working >:(

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

public class MouseLook : MonoBehaviour
{
public float mouseSensitivity = 100f;
public Transform playerBody;
float xRotation = 0f;
// Start is called before the first frame update
void Start()
{
Cursor.lockState = CursorLockMode.Locked;
}

// Update is called once per frame
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 = Quarternion.Euler(xRotation,0f,0f);
playerBody.Rotate(Vector3.up * mouseX);
}
}

[/code]

Hi and welcome,

It looks like you spelled out your mistake (at least the elemental one) in your topic:
quartenion when it should be quaternion. Every character counts so you have to be exact.

Does your IDE show errors? I’m just interested because you should have seen a squiggly line under that error.

P.S You made an attempt to use code tags, but it’s not exactly correct. Perhaps you can edit your post to get it work ok? :slight_smile:

Besides the misspelled “Quarternion”, when using a mouse axis, you actually don’t want to multiply by Time.deltaTime. Mouse deltas are already framerate-independent, and multiplying the deltaTime will actually make the motion jerky.

1 Like

thnx sooooo much i REALLY APPRECIATE IT

yes it does not work for some reason u know y?

Which IDE are you using? VS Code? Visual Studio? VS Code is known to have issues that it does not function always correctly.

Here is a thread where this issue is discussed about:

You can also search for “intellisense not working in vs code with Unity” or something similar and it will give you a few hits to discussions on other sites.