// Update is called once per frame void Update() { if (!objectPickUp.GetComponent <ObjectPickUp>().isObjectPickUp) { 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, 90); transform.localRotation = Quaternion.Euler(xRotation, 0f, 0f); playerBody.Rotate(Vector3.up * mouseX); } }
// Update is called once per frame void Update() { if (!objectPickUp.GetComponent <ObjectPickUp>().isObjectPickUp) { float x = Input.GetAxis("Horizontal"); float z = Input.GetAxis("Vertical"); move = transform.right * x + transform.forward * z; controller.Move(move * speed * Time.deltaTime); if (move == isNotMoving) { isPlayerMoving = false; } if (move.z > 0f || move.z < 0f || move.x > 0f || move.x < 0f) { isPlayerMoving = true; } } }
// Start is called before the first frame update void Start() { objectPick.GetComponent <ObjectPickUp>(); }