取りえずIKを使い武器を手にしっかり持たせました。画像の通り子の空のオブジェクトをIKの座標してそれを武器オブジェクトに当てるという方法で実装しています。
1、実行すると合わせた角度で実行されているが貫通してしまっている問題を解決したいです。
2、子の空のオブジェクトをIKが取得する座標にしてその座標に武器オブジェクトを合わせるように重ねましたがこれは正しいのでしょうか?
以下 IKスクリプト
using System.Collections; using System.Collections.Generic; using UnityEngine; public class Player_IK : MonoBehaviour { Animator ani; public Transform LeftHand; // Start is called before the first frame update void Start() { ani = GetComponent<Animator>(); } // Update is called once per frame void Update() { } private void OnAnimatorIK() { if(LeftHand != null) { ani.SetIKPositionWeight(AvatarIKGoal.LeftHand, 1); ani.SetIKRotationWeight(AvatarIKGoal.LeftHand, 1); ani.SetIKPosition(AvatarIKGoal.LeftHand, LeftHand.position); ani.SetIKRotation(AvatarIKGoal.LeftHand, LeftHand.rotation); } } }
あなたの回答
tips
プレビュー