中文字幕无码a片久久,亚洲日韩在线观看浪潮,人人超人人超碰超国产二区,国产人妻久久一区二区,国产人妻久久一区二区

福感科技有限公司 歡迎您!
聯(lián)系方式

    地址:北京市平谷區(qū)馬坊鎮(zhèn)金河北街17號(hào)院3號(hào)樓7層712

    電話:010-89968230

    網(wǎng)站:http://0743119.com

U3d中如何計(jì)算角度偏移

2020-10-28 19:31:52??????點(diǎn)擊:

    U3d角度偏移計(jì)算方法:


using UnityEngine;
using System.Collections;
 
public class UserAnimatorMove : MonoBehaviour
{
    private Vector3 oldVector3;
    private Vector3 newVector3;
    private Quaternion oldQuaternion;
    private Vector3 newRotatinForward;
    void Start()
    {

    }
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.F1))
        {
 
            oldVector3 = this.transform.position;
            oldQuaternion = this.transform.rotation;
        }
        if (Input.GetKeyDown(KeyCode.F2))
        {
            StartCoroutine(MovePoint());
        }
    }
    private IEnumerator MovePoint()
    {
        //    oldVector3 = this.transform.position;
        //   oldQuaternion = this.transform.rotation;
        yield return new WaitForSeconds(0.2f);
        newVector3 = this.transform.position;
        newRotatinForward = this.transform.forward;
 
        float lenth = Vector3.Distance(oldVector3, newVector3);
        Vector3 velocity = Quaternion.Inverse(oldQuaternion) * newRotatinForward;
        float angle = Mathf.Atan2(velocity.x, velocity.z) * 180.0f / 3.14159f;
        Debug.Log(angle);//新的方向相對(duì)舊的方向的偏轉(zhuǎn)角度
    }
}


Copyright 2019 0743119.com

福感科技有限公司 版權(quán)所有 All Rights Reserved

京ICP備20002031號(hào)

010-89968230