implementation of drecon in unity 2022 lts forked from: https://github.com/joanllobera/marathon-envs
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

48 lines
1007 B

using System.Collections;
using System.Collections.Generic;
using Cinemachine;
using UnityEngine;
using UnityEngine.Pool;
public class FindTargetAnimationRagdool : MonoBehaviour
{
private Transform m_LookAt;
private Transform m_Follow;
private CinemachineVirtualCamera m_VirtualCamera;
private bool m_Search = false;
private GameObject m_Ragdoll;
private void Start(){
m_VirtualCamera = this.GetComponent<CinemachineVirtualCamera>();
}
private void Update(){
if(!m_Search){
try{
m_Ragdoll = GameObject.Find("RagdollForMocap");
if(m_Ragdoll != null){
m_Search = true;
SetupVirtualCameraSettings();
}
} catch {
Debug.Log("Ragdoll Animator not found.");
}
}
}
private void SetupVirtualCameraSettings(){
//Do something
Debug.Log("Found.");
m_LookAt = m_Ragdoll.transform.Find("articulation:Hips");
m_Follow = m_Ragdoll.transform.Find("articulation:Hips");
m_VirtualCamera.LookAt = m_LookAt;
m_VirtualCamera.Follow = m_Follow;
}
}