-
Notifications
You must be signed in to change notification settings - Fork 0
/
IKCOMPONENT.cs
54 lines (53 loc) · 2.06 KB
/
IKCOMPONENT.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
using System;
using UnityEngine;
using static vehiclemod.data;
using MelonLoader;
using SkyCoop;
namespace vehiclemod
{
public class IKVH : MonoBehaviour
{
public IKVH(IntPtr ptr) : base(ptr) { }
private Transform RL = null, LL = null, LA = null, RA = null;
private Animator anim = null;
public void Init(int CarId, int sit)
{
InfoMain c = GetObj(CarId).GetComponent<VehComponent>().vehicleData;
RL = c.m_Sits[sit].transform.Find("RL");
LL = c.m_Sits[sit].transform.Find("LL");
LA = c.m_Sits[sit].transform.Find("LA");
RA = c.m_Sits[sit].transform.Find("RA");
anim = GetComponent<SkyCoop.MyMod.MultiplayerPlayerAnimator>().m_Animer;
}
public void OnAnimatorIK(int _layerIndex)
{
if (anim)
{
MelonLogger.Msg("fgsdg");
if (RL)
{
anim.SetIKPositionWeight(AvatarIKGoal.RightFoot, 1);
anim.SetIKPosition(AvatarIKGoal.RightFoot, RL.position);
}
else anim.SetIKPositionWeight(AvatarIKGoal.RightFoot, 0);
if (LL)
{
anim.SetIKPositionWeight(AvatarIKGoal.LeftFoot, 1);
anim.SetIKPosition(AvatarIKGoal.LeftFoot, LL.position);
}
else anim.SetIKPositionWeight(AvatarIKGoal.LeftFoot, 0);
if (LA)
{
anim.SetIKPositionWeight(AvatarIKGoal.LeftHand, 1);
anim.SetIKPosition(AvatarIKGoal.LeftHand, RA.position);
} else anim.SetIKPositionWeight(AvatarIKGoal.LeftHand, 0);
if (LA)
{
anim.SetIKPositionWeight(AvatarIKGoal.RightHand, 1);
anim.SetIKPosition(AvatarIKGoal.RightHand, RA.position);
}
else anim.SetIKPositionWeight(AvatarIKGoal.RightHand, 0);
}
}
}
}