예제 #1
0
    public void OnClickBtn6()
    {
        Demo.displayText = "\n  " + "<color=red>" + "开始运动至期望位姿" + "</color>";
        Demo.flag2       = true;

        Demo.pose[0] = System.Convert.ToDouble(InputX.text);
        InputX.text  = "";

        Demo.pose[1] = System.Convert.ToDouble(InputY.text);
        InputY.text  = "";

        Demo.pose[2] = System.Convert.ToDouble(InputZ.text);
        InputZ.text  = "";

        Demo.pose[3] = System.Convert.ToDouble(InputQ1.text);
        InputQ1.text = "";

        Demo.pose[4] = System.Convert.ToDouble(InputQ2.text);
        InputQ2.text = "";

        Demo.pose[5] = System.Convert.ToDouble(InputQ3.text);
        InputQ3.text = "";

        Demo.pose[6] = System.Convert.ToDouble(InputQ4.text);
        InputQ4.text = "";

        InputX.ActivateInputField();
        InputY.ActivateInputField();
        InputZ.ActivateInputField();
        InputQ1.ActivateInputField();
        InputQ2.ActivateInputField();
        InputQ3.ActivateInputField();
        InputQ4.ActivateInputField();
    }
예제 #2
0
    public override void Move(CharacterController controller, Transform transform)
    {
        rotateDirection.Set(InputRotateX.SetFloat(), InputRotateY.SetFloat(), InputRotateZ.SetFloat());
        transform.Rotate(rotateDirection);

        moveDirection.Set(InputX.SetFloat(), InputY.SetFloat(), InputZ.SetFloat());         //changed y from InputY.SetFloat()
        if (!controller.isGrounded)
        {
            moveDirection.y -= gravity * Time.deltaTime;
//			Debug.Log("Gravity!" + moveDirection.y);
        }

        moveDirection = transform.TransformDirection(moveDirection);

        if (moveSpeedMultiplier != null)
        {
            moveDirection *= speed * moveSpeedMultiplier.FloatValue;
        }
        else
        {
            moveDirection *= speed;
        }

        if (JumpInput.SetFloat() != 0)
        {
            moveDirection.y = JumpInput.SetFloat();
        }

        //Debug.Log(moveDirection);
        controller.Move(moveDirection * Time.deltaTime);
    }
예제 #3
0
    public override void Move(CharacterController controller, Transform transform)
    {
        if (controller.isGrounded)
        {
            moveDirection.Set(InputX.SetFloat(), InputY.SetFloat(), InputZ.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.y = InputY.SetFloat();
            moveDirection.z = InputZ.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 override void Move(CharacterController controller, Transform transform)
    {
        if (!controller.isGrounded)
        {
            moveDirection.y -= gravity * Time.deltaTime;
        }

        rotateDirection.Set(InputRotateX.SetFloat(), InputRotateY.SetFloat(), InputRotateZ.SetFloat());
        transform.Rotate(rotateDirection);

        moveDirection.Set(InputX.SetFloat(), InputY.SetFloat(), InputZ.SetFloat());
        moveDirection = transform.TransformDirection(moveDirection);

        moveDirection *= speed;

        if (JumpInput.SetFloat() != 0)
        {
            moveDirection.y = JumpInput.SetFloat();
        }

        //Debug.Log(moveDirection);
        controller.Move(moveDirection * Time.deltaTime);
    }