39 lines
1.1 KiB
C#
39 lines
1.1 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.Animations.Rigging;
|
|
|
|
public class MultiAimConstraintSetUpTarget : MonoBehaviour
|
|
{
|
|
[SerializeField] private RigBuilder RigBuilder;
|
|
[SerializeField] private MultiAimConstraint MultiAimConstraint;
|
|
public bool multiAimContraintShouldBePlayersHead = true;
|
|
public bool MultiAimWeightIsONOnStart = true;
|
|
|
|
private void Start()
|
|
{
|
|
if (multiAimContraintShouldBePlayersHead)
|
|
{
|
|
var data = MultiAimConstraint.data.sourceObjects;
|
|
data.SetTransform(0, PlayerManager.GetInstance().playerGameObj.transform.Find("MainCharacter/root/pelvis/spine_01/spine_02/spine_03/neck_01/head"));
|
|
MultiAimConstraint.data.sourceObjects = data;
|
|
|
|
RigBuilder.Build();
|
|
}
|
|
if (MultiAimWeightIsONOnStart)
|
|
{
|
|
MultiAimWeightIsOn();
|
|
}
|
|
}
|
|
|
|
public void MultiAimWeightIsOn()
|
|
{
|
|
MultiAimConstraint.weight = 1f;
|
|
}
|
|
|
|
|
|
public void MultiAimWeightIsOff()
|
|
{
|
|
MultiAimConstraint.weight = 0f;
|
|
}
|
|
} |