コード例 #1
0
        public void AlignObject()
        {
            Vector3        gripLocalPosition = new Vector3(-0.08f, 0.015f, -0.03f);
            Vector3        gripLocalRotation = new Vector3(150, 90, 180);
            ItemDefinition objectDefinition  = handleReference.GetComponentInParent <ItemDefinition>();

            objectDefinition.transform.MoveAlign(handleReference.transform, this.transform.TransformPoint(gripLocalPosition), this.transform.rotation * Quaternion.Euler(gripLocalRotation));
        }
コード例 #2
0
ファイル: HandPoseDefinition.cs プロジェクト: uiojkl09/BasSDK
        public void AlignObject()
        {
            ItemDefinition objectDefinition = handleReference.GetComponentInParent <ItemDefinition>();

            Vector3    orgHandleLocalPostion  = handleReference.transform.localPosition;
            Quaternion orgHandleLocalRotation = handleReference.transform.localRotation;

            handleReference.transform.position = handleReference.GetDefaultAxisPosition(side);
            handleReference.transform.position = handleReference.transform.TransformPoint(handleReference.GetDefaultOrientation(side).positionOffset);
            handleReference.transform.rotation = handleReference.transform.rotation * Quaternion.Euler(handleReference.GetDefaultOrientation(side).rotation);
            handleReference.transform.position = handleReference.transform.TransformPoint(new Vector3(side == Side.Right ? handleReference.ikAnchorOffset.x : -handleReference.ikAnchorOffset.x, handleReference.ikAnchorOffset.y, handleReference.ikAnchorOffset.z));

            if (objectDefinition != null)
            {
                objectDefinition.transform.MoveAlign(handleReference.transform, this.transform.TransformPoint(gripLocalPosition), this.transform.rotation * Quaternion.Euler(gripLocalRotation));
            }
            else
            {
                handleReference.transform.root.MoveAlign(handleReference.transform, this.transform.TransformPoint(gripLocalPosition), this.transform.rotation * Quaternion.Euler(gripLocalRotation));
            }

            handleReference.transform.localPosition = orgHandleLocalPostion;
            handleReference.transform.localRotation = orgHandleLocalRotation;
        }