Monday, October 17, 2022
HomeGame Developmentunity - Rotate FPS Controller with out Mouse

unity – Rotate FPS Controller with out Mouse


I am making an attempt to arrange a sport with portals in it. I have been struggling for some time now to rotate the Participant. I’ve tried Quat.Slerp, Quat.AngleAxis, and Quat.Euler. However by way of rigorous testing I found that the MouseLook operate in my FPS Controller script is the explanation the Participant is not rotating. The participant is being rotated, however half a body later, the MouseLook script resets the Participant’s rotation.
How can I rotate the participant with out letting the MouseLook operate of my FPS Controller script get in the way in which?

void MouseLook()
{   mouseX = Enter.GetAxisRaw("Mouse X") * sensX * Time.deltaTime;
    mouseY = Enter.GetAxisRaw("Mouse Y") * sensY * Time.deltaTime;
        
    yRot += mouseX;    xRot -= mouseY;
    xRot = Mathf.Clamp(xRot, -50f, 50f);
    rework.rotation = Quaternion.Euler(xRot, yRot, 0);
}

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments