public void Move(CharacterController controller, Transform transform) { //rotateDiraction.Set(InputRotateX.SetFloat(), InputRotateY.SetFloat()), InputRotateZ.SetFloat()); // transform.Rotate(rotateDirection); if (controller.isGrounded) { moveDirection = new Vector3(Input.GetAxis("Horizontal"), 0, Input.GetAxis("Vertical")); moveDirection.x = InputX.SetFloat(); moveDirection.y = InputY.SetFloat(); moveDirection.z = InputZ.SetFloat(); //moveDirection = transform.TransformDirection(moveDirection); moveDirection *= speed; if (Input.GetButton("Jump")) { moveDirection.y = jumpSpeed; } //moveDirection.y = jumpSpeed; } moveDirection.y -= gravity * Time.deltaTime; controller.Move(moveDirection * Time.deltaTime); }
public void Rotate() { Vector3 rotVector = new Vector3(floatX.SetFloat() + transform.position.x, floatY.SetFloat() + transform.position.y, floatZ.SetFloat() + transform.position.z); transform.LookAt(rotVector); }
public void Move(CharacterController controller, Transform transform) { if (controller.isGrounded) { //This is a boolean variable. (On/Off) //Place a ! before controller to make it move when not grounded. moveDirection.x = InputX.SetFloat(); moveDirection.z = InputZ.SetFloat(); moveDirection.y = InputY.SetFloat(); moveDirection = transform.TransformDirection(moveDirection); moveDirection *= speed; moveDirection.y = JumpInput.SetFloat(); } moveDirection.y -= gravity * Time.deltaTime; controller.Move(moveDirection * Time.deltaTime); }
public void Move(CharacterController controller, Transform transform) { if (controller.isGrounded) { moveDirection.x = Inputx.SetFloat(); moveDirection.z = Inputz.SetFloat(); moveDirection.y = Inputy.SetFloat(); moveDirection = transform.TransformDirection(moveDirection); moveDirection *= speed; if (Input.GetButton("Jump")) { moveDirection.y = jumpSpeed; } } moveDirection.y -= gravity * Time.deltaTime; controller.Move(moveDirection * Time.deltaTime); }
public void Move(CharacterController controller, Transform Mytransform) { if (controller.isGrounded) { moveDirection.x = InputX.SetFloat(); moveDirection.y = InputY.SetFloat(); moveDirection.z = InputZ.SetFloat(); moveDirection = Mytransform.TransformDirection(moveDirection); moveDirection *= speed; // if (Input.GetButton("Jump"))//bool.. boolean variable // moveDirection.y = jumpSpeed; } moveDirection.y -= gravity * Time.deltaTime; controller.Move(moveDirection * Time.deltaTime); }