diff options
Diffstat (limited to 'ActiveRagdoll/Assets/Scripts/LockTransform.cs')
-rw-r--r-- | ActiveRagdoll/Assets/Scripts/LockTransform.cs | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/ActiveRagdoll/Assets/Scripts/LockTransform.cs b/ActiveRagdoll/Assets/Scripts/LockTransform.cs new file mode 100644 index 0000000..fa2216f --- /dev/null +++ b/ActiveRagdoll/Assets/Scripts/LockTransform.cs @@ -0,0 +1,47 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class LockTransform : MonoBehaviour +{ + + [Flags] + public enum ESyncTransfom + { + Position, + Rotation, + Scale, + } + + public ESyncTransfom syncMode; + + public Transform target; + + private Vector3 _position; + private Quaternion _rotation; + private Vector3 _scale; + + private void Awake() + { + } + + void Update() + { + if (syncMode.HasFlag(ESyncTransfom.Position)) + { + transform.position = target.position; + } + + if (syncMode.HasFlag(ESyncTransfom.Rotation)) + { + transform.rotation = target.rotation; + } + + if (syncMode.HasFlag(ESyncTransfom.Scale)) + { + transform.localScale = target.localScale; + } + } + +} |