How to make diablo 3 wasd script not mouse cursor go to the ceneter of screen ownedcore forums2/24/2024 If you speed the frame rate up, you would also get 10 units a second (1 x 10 = 10). Each frame is 0.1 second, so when multiplying it by 10 (the speed), you get a value of one. If you have a frame rate of 10fps (hopefully you don't), you would have each frame in 0.1 second. This is because when multiplying by ltaTime, you get a constant speed of one unit per second: float speed = 10f ltaTime is used when you want to have different devices with different frame rates. The problem is that you are multiplying the mouse input by ltaTime. Transform.Rotate(Vector3.up * mouseX * 3) Rotate the player based on the X input of the mouse XRotation = Mathf.Clamp(xRotation, _minCameraview, _maxCameraview) clamp the camera rotation between 80 and -70 degrees Rotate the camera based on the Y input of the mouse _charController.Move(movement * ltaTime * _speed) įloat mouseX = Input.GetAxis("Mouse X") * _mouseSensitivity * ltaTime įloat mouseY = Input.GetAxis("Mouse Y") * _mouseSensitivity * ltaTime Vector3 movement = Vector3.forward * vertical + Vector3.right * horizontal Start is called before the first frame updateĭebug.Log("No Character Controller Attached to Player") Ĭursor.lockState = CursorLockMode.Locked įloat vertical = Input.GetAxis("Vertical") įloat horizontal = Input.GetAxis("Horizontal") Private CharacterController _charController Private float _minCameraview = -70f, _maxCameraview = 80f Public class Player_Controller : MonoBehaviour Here is my script: using System.Collections I start the game, the cursor locks into the game screen and I can move but I can't look around and there are no bugs. I am writing a script for movement and mouselook, the movement works but the mouse look does not.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |