29 lines
707 B
C#
29 lines
707 B
C#
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);
|
|
}
|
|
}
|