23 lines
479 B
C#
23 lines
479 B
C#
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;
|
|
}
|
|
}
|
|
}
|
|
} |