예제 #1
0
    public Vector3 resetObject(GameObject obj)
    {
        //让速度变为0
        obj.GetComponent <Rigidbody>().constraints = RigidbodyConstraints.FreezeAll;
        obj.GetComponent <Rigidbody>().constraints = RigidbodyConstraints.None;
        //role.GetComponent<Rigidbody>().velocity = Vector3.zero;//光设速度为0不行的,位置不变但rotation还是会变
        //恢复旋转
        obj.transform.rotation = Quaternion.Euler(0, 0, 0);

        //恢复位置
        Vector3 center            = diskObject.transform.position;
        Vector3 originalRolePoint = new Vector3(0f, 2f, -2.5f);
        //float angle = index * 90;
        float   angle = PUNConnect.getAngle(obj.name);
        Vector3 axis  = Vector3.up;
        Vector3 point = Quaternion.AngleAxis(angle, axis) * (originalRolePoint - center);

        Debug.Log("standup++++++++++++point:" + point + ", center:" + center + ", name:" + obj.name);
        obj.transform.position = point;

        return(point);
    }
예제 #2
0
파일: testCollider.cs 프로젝트: wqyhuai/spy
 void Start()
 {
     punScript = GameObject.Find("MainCamera").GetComponent <PUNConnect>();
 }