Reset button, animation cancel, world check, VR offset fix

This commit is contained in:
SDraw 2023-04-08 17:12:54 +03:00
parent 8ffc876376
commit 8bee0d2adf
No known key found for this signature in database
GPG key ID: BB95B4DAB2BB8BB5
5 changed files with 128 additions and 18 deletions

View file

@ -1,13 +1,22 @@
using UnityEngine;
using ABI.CCK.Components;
using UnityEngine;
namespace ml_prm
{
static class Utils
{
public static bool IsInVR() => ((ABI_RC.Core.Savior.CheckVR.Instance != null) && ABI_RC.Core.Savior.CheckVR.Instance.hasVrDeviceLoaded);
public static bool IsWorldSafe() => ((CVRWorld.Instance != null) && CVRWorld.Instance.allowFlying && CVRWorld.Instance.allowSpawnables);
public static void CopyGlobal(this Transform p_source, Transform p_target)
{
p_target.position = p_source.position;
p_target.rotation = p_source.rotation;
}
public static Matrix4x4 GetMatrix(this Transform p_transform, bool p_pos = true, bool p_rot = true, bool p_scl = false)
{
return Matrix4x4.TRS(p_pos ? p_transform.position : Vector3.zero, p_rot ? p_transform.rotation : Quaternion.identity, p_scl ? p_transform.localScale : Vector3.one);
}
}
}