Fix aiming animation and mesh rotation
This commit is contained in:
parent
9d491d34de
commit
68eab14326
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -23,7 +23,10 @@ namespace NeonTea.Quakeball.Animation {
|
|||||||
private Animator Animator;
|
private Animator Animator;
|
||||||
private Transform BehindHand;
|
private Transform BehindHand;
|
||||||
private Transform FrontHand;
|
private Transform FrontHand;
|
||||||
private Transform Head;
|
private Transform Torso;
|
||||||
|
|
||||||
|
private float VisualYaw;
|
||||||
|
private float VisualPitch;
|
||||||
|
|
||||||
private void Awake() {
|
private void Awake() {
|
||||||
foreach (Animator animator in Soldiers) {
|
foreach (Animator animator in Soldiers) {
|
||||||
@ -31,7 +34,8 @@ namespace NeonTea.Quakeball.Animation {
|
|||||||
}
|
}
|
||||||
Animator = Soldiers[(int)Model].GetComponent<Animator>();
|
Animator = Soldiers[(int)Model].GetComponent<Animator>();
|
||||||
Animator.gameObject.SetActive(true);
|
Animator.gameObject.SetActive(true);
|
||||||
HeadCollider.parent = Head = TransformUtil.FindChildWithName(Animator.transform, "HEAD");
|
HeadCollider.parent = TransformUtil.FindChildWithName(Animator.transform, "HEAD");
|
||||||
|
Torso = TransformUtil.FindChildWithName(Animator.transform, "RIBS");
|
||||||
BehindHand = TransformUtil.FindChildWithName(Animator.transform, "HAND.R");
|
BehindHand = TransformUtil.FindChildWithName(Animator.transform, "HAND.R");
|
||||||
FrontHand = TransformUtil.FindChildWithName(Animator.transform, "HAND.L");
|
FrontHand = TransformUtil.FindChildWithName(Animator.transform, "HAND.L");
|
||||||
if (GunGluedToHand) {
|
if (GunGluedToHand) {
|
||||||
@ -47,8 +51,11 @@ namespace NeonTea.Quakeball.Animation {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void LateUpdate() {
|
private void LateUpdate() {
|
||||||
transform.localEulerAngles = new Vector3(0, Player.Yaw, 0);
|
VisualYaw = Mathf.Lerp(VisualYaw, Player.Yaw, 10f * Time.deltaTime);
|
||||||
Head.localEulerAngles = new Vector3(Player.Pitch, 0, 0);
|
VisualPitch = Mathf.Lerp(VisualPitch, -Player.Pitch, 10f * Time.deltaTime);
|
||||||
|
|
||||||
|
transform.localEulerAngles = new Vector3(0, VisualYaw, 0);
|
||||||
|
Torso.localEulerAngles = new Vector3(VisualPitch, 0, 0);
|
||||||
|
|
||||||
if (GunGluedToHand) {
|
if (GunGluedToHand) {
|
||||||
Vector3 GunOffset = GunHandle.position - Gun.position;
|
Vector3 GunOffset = GunHandle.position - Gun.position;
|
||||||
|
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user