123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- using System;
- using kt.ik;
- using UnityEngine;
- [Serializable]
- public class MuneIKCtrl : FreeFBIKCtrl
- {
- public MuneIKCtrl(FullBodyIKMgr ik_mgr, FullBodyIKMgr.IKEffectorType effector_type) : base(ik_mgr, effector_type, true, FullBodyIKMgr.IKBoneType.None)
- {
- }
- private string AttachPointName
- {
- get
- {
- return (this.effectorType != FullBodyIKMgr.IKEffectorType.Bust_L) ? "乳首右" : "乳首左";
- }
- }
- public override void SetIKSetting(IKAttachParam param)
- {
- base.SetIKSetting(param);
- base.isNeedAttachTargetUpdatePreExec = true;
- }
- protected override void SetTargetTransform(AIKCtrl.IKSettingData data, Vector3 pos, Quaternion rot)
- {
- if (data.isPointAttach)
- {
- Vector3 b = base.bone.position - this.GetNipplePosRot().pos;
- pos += b;
- }
- base.SetTargetTransform(data, pos, rot);
- }
- private AIKCtrl.PosRotPair GetNipplePosRot()
- {
- AIKCtrl.PosRotPair result = default(AIKCtrl.PosRotPair);
- int slotNo = this.myIKMgr.body.GetSlotNo("body");
- if (this.myIKMgr.body.goSlot[slotNo].morph == null)
- {
- return result;
- }
- Vector3 pos;
- Quaternion rot;
- Vector3 vector;
- if (this.myIKMgr.body.goSlot[slotNo].morph.GetAttachPoint(this.AttachPointName, out pos, out rot, out vector, false))
- {
- result.pos = pos;
- result.rot = rot;
- }
- return result;
- }
- }
|