add some extra assets FX and SFX
This commit is contained in:
54
Assets/Kevin Iglesias/IKHelperTool/Scripts/IKHelperTool.cs
Normal file
54
Assets/Kevin Iglesias/IKHelperTool/Scripts/IKHelperTool.cs
Normal file
@@ -0,0 +1,54 @@
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// IKHelperTool //
|
||||
// Kevin Iglesias - https://www.keviniglesias.com/ //
|
||||
// Contact Support: support@keviniglesias.com //
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace KevinIglesias {
|
||||
|
||||
public enum IKHelperHand {LeftHand = 0, RightHand = 1};
|
||||
|
||||
public class IKHelperTool : MonoBehaviour
|
||||
{
|
||||
public Transform iKSwitch;
|
||||
public Transform handEffector;
|
||||
|
||||
public IKHelperHand hand;
|
||||
|
||||
private Animator animator;
|
||||
private float weight;
|
||||
|
||||
void Awake()
|
||||
{
|
||||
animator = GetComponent<Animator>();
|
||||
weight = 0f;
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
weight = Mathf.Lerp(0, 1, 1f - Mathf.Cos(iKSwitch.localPosition.y * Mathf.PI * 0.5f));
|
||||
}
|
||||
|
||||
void OnAnimatorIK(int layerIndex)
|
||||
{
|
||||
if(hand == IKHelperHand.LeftHand)
|
||||
{
|
||||
animator.SetIKPositionWeight(AvatarIKGoal.LeftHand, weight);
|
||||
animator.SetIKPosition(AvatarIKGoal.LeftHand, handEffector.position);
|
||||
|
||||
animator.SetIKRotationWeight(AvatarIKGoal.LeftHand, weight);
|
||||
animator.SetIKRotation(AvatarIKGoal.LeftHand, handEffector.rotation);
|
||||
}else{
|
||||
animator.SetIKPositionWeight(AvatarIKGoal.RightHand, weight);
|
||||
animator.SetIKPosition(AvatarIKGoal.RightHand, handEffector.position);
|
||||
|
||||
animator.SetIKRotationWeight(AvatarIKGoal.RightHand, weight);
|
||||
animator.SetIKRotation(AvatarIKGoal.RightHand, handEffector.rotation);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a9e61810448c4394d92f341a80513181
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 148408
|
||||
packageName: IK Helper Tool
|
||||
packageVersion: 1.0.1
|
||||
assetPath: Assets/Kevin Iglesias/IKHelperTool/Scripts/IKHelperTool.cs
|
||||
uploadId: 719182
|
||||
Reference in New Issue
Block a user