Fixes demon & Giant
This commit is contained in:
23
Assets/AI/Gigant/LookAtPlayerInitialization.cs
Normal file
23
Assets/AI/Gigant/LookAtPlayerInitialization.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using RootMotion.FinalIK;
|
||||
using UnityEngine;
|
||||
|
||||
public class LookAtPlayerInitialization : MonoBehaviour
|
||||
{
|
||||
public LookAtIK lookAtIK;
|
||||
public string playerTag = "Player";
|
||||
private Transform player;
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
GameObject playerObj = GameObject.FindGameObjectWithTag(playerTag);
|
||||
if (playerObj != null)
|
||||
{
|
||||
player = playerObj.transform;
|
||||
if (lookAtIK != null)
|
||||
{
|
||||
lookAtIK.solver.target = player;
|
||||
lookAtIK.solver.IKPositionWeight = 1f;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user