

Left mouse click : (same ) Rotate + up and down I am searching the web for age to find a WOW like mouse / camera movement to ,īy combining som scripts together i manage the following : I would love to know if you have succes with this movements script, MoveDirection.y -= gravity * ltaTime Ĭontroller.Move(moveDirection * ltaTime)

Transform.Rotate(0, rotate * rotateSpeed * ltaTime, 0) Transform.rotation = Quaternion.Euler(0, .y, 0) Keep the character facing in the same direction as the Camera if the right mouse button is down.

MoveDirection = transform.TransformDirection(moveDirection) Įlse if (jumpTimer >= antiBunnyHopFactor) MoveDirection = new Vector3(horizontal * inputModifyFactor, 0, vertical * inputModifyFactor) Var inputModifyFactor = (horizontal != 0.0 & vertical != 0.0 & limitDiagonalSpeed)?. Var rightMouse = Input.GetMouseButton(1) Var vertical = Input.GetAxis("Vertical") Var horizontal = Input.GetAxis("Horizontal") Var controller : CharacterController = GetComponent(CharacterController) Private var moveDirection : Vector3 = Vector3.zero Here is the code: RequireComponent(CharacterController) So I’m wondering if there is some way I can lock the cursor co-ordinates while Screen.showCursor = false The reason I don’t want to use Screen.lockCursor is because it goes back to the center of the screen every time I let go. But heres the catch - when I use Screen.showCursor and move the mouse, the cursor is in a different location. Basically what I want to do with that is to hide the cursor when pressing Right Mouse Button or Left Mouse Button or Both at the same time. How would I go about doing these?Īlso, at the bottom I added a FreezeCursor function. Also, I don’t know how to go about making my character move forward when both Left and Right Mouse Buttons are pressed. I want the rotate keys to act just the strafe keys when holding down the Right Mouse Button.

It’s a wow-like movement script, and it’s almost perfect! I can’t seem to figure out how to make my character strafe when holding down the Right Mouse Button and Rotate keys (A and D… my strafe keys are Q and E). Hello, I need some help with this script.
