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.

29 lines
707 B

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class LockTarget : MonoBehaviour
{
public Transform m_Object;
private Vector3 m_Position;
private Quaternion m_Rotation;
private void OnEnable(){
m_Position = m_Object.position;
m_Rotation = m_Object.rotation;
Debug.Log($"{m_Position} pos");
}
void FixedUpdate()
{
Vector3 newPosition = m_Object.position;
Vector3 normPosition = new Vector3(newPosition.x, m_Position.y, newPosition.z);
this.transform.position = normPosition;
Quaternion newRotation = m_Object.rotation;
this.transform.rotation = new Quaternion(m_Rotation.x, newRotation.y, m_Rotation.z, m_Rotation.w);
}
}