Improved usage of PhysicsInfluencer, pointer-based grabbing

This commit is contained in:
SDraw 2025-06-26 18:59:35 +03:00
parent aa5856b102
commit aef5af99af
No known key found for this signature in database
GPG key ID: BB95B4DAB2BB8BB5
8 changed files with 92 additions and 300 deletions

View file

@ -27,7 +27,6 @@ namespace ml_prm
yield return null;
m_controller = new UnityEngine.GameObject("[PlayerRagdollMod]").AddComponent<RagdollController>();
m_controller.gameObject.AddComponent<RemoteGesturesManager>();
}
System.Collections.IEnumerator WaitForWhitelist()

View file

@ -36,8 +36,7 @@ namespace ml_prm
RecoverDelay,
FallLimit,
GestureGrab,
FriendsGrab,
GrabDistance
FriendsGrab
}
const string c_ragdollKeyTooltip = "Switch ragdoll mode with '{0}' key";
@ -69,7 +68,6 @@ namespace ml_prm
static SliderFloat ms_angularMovementDragSlider = null;
static SliderFloat ms_recoverDelaySlider = null;
static SliderFloat ms_fallLimitSlider = null;
static SliderFloat ms_grabDistanceSlider = null;
static Button ms_resetButton = null;
internal static void Init()
@ -145,9 +143,6 @@ namespace ml_prm
ms_fallLimitSlider.SliderTooltip = string.Format(c_fallLimitTooltip, GetDropHeight(Settings.FallLimit));
ms_fallLimitSlider.OnValueUpdated += (value) => OnSliderUpdate(UiIndex.FallLimit, value);
ms_grabDistanceSlider = ms_category.AddSlider("Grab distance", "Minimal distance for successful grab", Settings.GrabDistance, 0f, 1f);
ms_grabDistanceSlider.OnValueUpdated += (value) => OnSliderUpdate(UiIndex.GrabDistance, value);
ms_resetButton = ms_category.AddButton("Reset settings", "", "Reset mod settings to default");
ms_resetButton.OnPress += Reset;
}
@ -261,10 +256,6 @@ namespace ml_prm
ms_fallLimitSlider.SliderTooltip = string.Format(c_fallLimitTooltip, GetDropHeight(p_value));
}
break;
case UiIndex.GrabDistance:
Settings.SetSetting(Settings.ModSetting.GrabDistance, p_value);
break;
}
}
catch(Exception e)
@ -331,9 +322,6 @@ namespace ml_prm
OnSliderUpdate(UiIndex.FallLimit, 9.899494f);
ms_fallLimitSlider.SetSliderValue(9.899494f);
OnSliderUpdate(UiIndex.GrabDistance, 0.1f);
ms_grabDistanceSlider.SetSliderValue(0.1f);
}
static void OnHotkeyKeyChanged(UnityEngine.KeyCode p_keyCode)

View file

@ -41,7 +41,6 @@ Optional mod's settings page with [BTKUILib](https://github.com/BTK-Development/
* **Angular movement drag:** angular movement resistance; `2.0` by default.
* **Recover delay:** time delay for enabled `Auto recover` in seconds; `3.0` by default.
* **Fall limit:** height limit for fall damage; `5.0` by default.
* **Grab distance:** minimal distance for successful grab; `0.1` by default.
* **Reset settings:** resets mod settings to default.
Optional mod's settings in [UIExpansionKit](https://github.com/ddakebono/ChilloutMods):

View file

@ -1,4 +1,6 @@
using ABI.CCK.Components;
using ABI_RC.Core;
using ABI_RC.Core.Networking.IO.Social;
using ABI_RC.Core.Player;
using ABI_RC.Core.Savior;
using ABI_RC.Systems.Movement;
@ -10,24 +12,24 @@ namespace ml_prm
class RagdollBodypartHandler : MonoBehaviour, CVRTriggerVolume
{
const string c_ragdollPointerType = "ragdoll";
const string c_grabPointerType = "grab";
bool m_ready = false;
Rigidbody m_rigidBody = null;
public Collider collider { get; set; } = null;
PhysicsInfluencer m_physicsInfluencer = null;
bool m_shouldHaveInfluencer = false;
bool m_activeGravity = true;
PhysicsInfluencer m_physicsInfluencer = null;
public bool UseBuoyancy { get; set; } = false;
bool m_attached = false;
Transform m_attachedHand = null;
CVRPointer m_attachedPointer = null;
Transform m_attachTransform = null;
FixedJoint m_attachJoint = null;
// Unity events
void Awake()
{
this.gameObject.layer = LayerMask.NameToLayer("PlayerLocal");
collider = this.GetComponent<Collider>();
m_rigidBody = this.GetComponent<Rigidbody>();
@ -40,30 +42,25 @@ namespace ml_prm
}
if(collider != null)
{
Physics.IgnoreCollision(collider, BetterBetterCharacterController.Instance.Collider, true);
Physics.IgnoreCollision(collider, BetterBetterCharacterController.Instance.KinematicTriggerProxy.Collider, true);
Physics.IgnoreCollision(collider, BetterBetterCharacterController.Instance.NonKinematicProxy.Collider, true);
Physics.IgnoreCollision(collider, BetterBetterCharacterController.Instance.SphereProxy.Collider, true);
BetterBetterCharacterController.Instance.IgnoreCollision(collider, true);
}
BetterBetterCharacterController.Instance.IgnoreCollision(collider);
}
void Start()
{
if(m_shouldHaveInfluencer && (m_rigidBody != null) && (collider != null))
if((m_rigidBody != null) && (collider != null))
{
m_physicsInfluencer = this.gameObject.AddComponent<PhysicsInfluencer>();
m_physicsInfluencer.fluidDrag = 3f;
m_physicsInfluencer.fluidAngularDrag = 1f;
m_physicsInfluencer.enableBuoyancy = true;
m_physicsInfluencer.enableInfluence = false;
m_physicsInfluencer.forceAlignUpright = false;
float mass = m_rigidBody.mass;
m_physicsInfluencer.UpdateDensity();
m_rigidBody.mass = mass;
m_physicsInfluencer.volume = mass * 0.005f;
m_physicsInfluencer.enableInfluence = true;
m_physicsInfluencer.enableLocalGravity = true;
m_physicsInfluencer.enableBuoyancy = true;
m_physicsInfluencer.forceAlignUpright = false;
float l_mass = m_rigidBody.mass;
m_physicsInfluencer.UpdateDensity();
m_rigidBody.mass = l_mass;
m_physicsInfluencer.volume = l_mass * 0.005f;
this.gameObject.name = string.Format("{0} [NoGizmo]", this.gameObject.name);
}
@ -83,45 +80,36 @@ namespace ml_prm
Detach();
}
void FixedUpdate()
{
if(m_rigidBody != null)
{
m_rigidBody.useGravity = false;
if(!m_attached && m_activeGravity && ((m_physicsInfluencer == null) || !m_physicsInfluencer.enableInfluence || !m_physicsInfluencer.GetSubmerged()))
m_rigidBody.AddForce(BetterBetterCharacterController.Instance.GravityResult.AppliedGravity * m_rigidBody.mass);
}
}
void Update()
{
if(m_attached && !ReferenceEquals(m_attachTransform, null) && (m_attachTransform == null))
{
m_attachTransform = null;
if(m_attachJoint != null)
Object.Destroy(m_attachJoint);
m_attachJoint = null;
m_attachedHand = null;
m_attached = false;
}
if(m_attached && ((m_attachedPointer == null) || !m_attachedPointer.isActiveAndEnabled))
Detach();
}
void OnTriggerEnter(Collider p_col)
{
if(Settings.PointersReaction && (RagdollController.Instance != null) && !RagdollController.Instance.IsRagdolled())
if(m_ready && (RagdollController.Instance != null))
{
CVRPointer l_pointer = p_col.GetComponent<CVRPointer>();
if((l_pointer != null) && (l_pointer.type == c_ragdollPointerType) && l_pointer.enabled && !IsIgnored(l_pointer.transform))
RagdollController.Instance.Ragdoll();
// Ragdolling
if(Settings.PointersReaction && !RagdollController.Instance.IsRagdolled())
{
if((l_pointer != null) && (l_pointer.type == c_ragdollPointerType) && l_pointer.enabled && !IgnoreCheck(l_pointer.transform))
RagdollController.Instance.Ragdoll();
}
//Attachment
if(!m_attached && RagdollController.Instance.IsRagdolled())
{
if((l_pointer != null) && (l_pointer.type == c_grabPointerType) && RestrictionsCheck(p_col.transform.root))
Attach(l_pointer);
}
}
}
// Arbitrary
public bool IsReady() => ((m_rigidBody != null) && (collider != null) && (!m_shouldHaveInfluencer || ((m_physicsInfluencer != null) && m_physicsInfluencer.IsReady())));
public void SetInfuencerUsage(bool p_state) => m_shouldHaveInfluencer = p_state;
public bool IsReady() => ((m_rigidBody != null) && (collider != null) && (m_physicsInfluencer != null) && m_physicsInfluencer.IsReady());
public void SetColliderMaterial(PhysicMaterial p_material)
{
@ -134,13 +122,13 @@ namespace ml_prm
public void SetAsKinematic(bool p_state)
{
if(collider != null)
collider.isTrigger = p_state;
if(m_rigidBody != null)
{
m_rigidBody.isKinematic = p_state;
m_rigidBody.collisionDetectionMode = (p_state ? CollisionDetectionMode.Discrete : CollisionDetectionMode.ContinuousDynamic);
}
if(m_physicsInfluencer != null)
m_physicsInfluencer.enabled = !p_state;
}
public void SetVelocity(Vector3 p_vec)
@ -157,10 +145,8 @@ namespace ml_prm
public void SetActiveGravity(bool p_state)
{
m_activeGravity = p_state;
if(m_physicsInfluencer != null)
m_physicsInfluencer.enabled = m_activeGravity;
m_physicsInfluencer.gravityFactor = (p_state ? 1f : 0f);
}
public void SetDrag(float p_value)
@ -188,7 +174,7 @@ namespace ml_prm
public void SetBuoyancy(bool p_state)
{
if(m_physicsInfluencer != null)
m_physicsInfluencer.enableInfluence = p_state;
m_physicsInfluencer.enableBuoyancy = (UseBuoyancy && p_state);
}
public void ClearFluidVolumes()
@ -197,21 +183,27 @@ namespace ml_prm
m_physicsInfluencer.ClearFluidVolumes();
}
static bool IsIgnored(Transform p_transform)
internal void RemovePhysicsController()
{
return (Settings.IgnoreLocal && (p_transform.root == PlayerSetup.Instance.transform));
if(this.gameObject.TryGetComponent<CVRSharedPhysicsController>(out var l_controller))
{
Object.Destroy(l_controller); // Yeet!
m_ready = true;
}
if(collider != null)
BetterBetterCharacterController.Instance.IgnoreCollision(collider);
}
public bool Attach(Transform p_hand, Vector3 p_pos)
void Attach(CVRPointer p_pointer)
{
bool l_result = false;
if(!m_attached && (collider != null) && (Vector3.Distance(p_pos, collider.ClosestPoint(p_pos)) <= Settings.GrabDistance))
if(!m_attached && (collider != null) && (m_rigidBody != null))
{
m_attachedPointer = p_pointer;
GameObject l_attachPoint = new GameObject("[AttachPoint]");
l_attachPoint.layer = CVRLayers.PlayerClone;
m_attachTransform = l_attachPoint.transform;
m_attachTransform.parent = p_hand;
m_attachTransform.position = p_pos;
m_attachTransform.parent = p_pointer.transform;
Rigidbody l_body = l_attachPoint.AddComponent<Rigidbody>();
l_body.isKinematic = true;
@ -223,16 +215,12 @@ namespace ml_prm
m_attachJoint.breakTorque = Mathf.Infinity;
m_attached = true;
m_attachedHand = p_hand;
l_result = true;
}
return l_result;
}
public void Detach() => Detach(m_attachedHand);
public void Detach(Transform p_hand)
public void Detach()
{
if(m_attached && ReferenceEquals(m_attachedHand, p_hand))
if(m_attached)
{
if(m_attachTransform != null)
Object.Destroy(m_attachTransform.gameObject);
@ -242,7 +230,7 @@ namespace ml_prm
Object.Destroy(m_attachJoint);
m_attachJoint = null;
m_attachedHand = null;
m_attachedPointer = null;
m_attached = false;
}
}
@ -250,11 +238,29 @@ namespace ml_prm
// CVRTriggerVolume
public void TriggerEnter(CVRPointer pointer)
{
if(Settings.PointersReaction && (pointer != null) && pointer.enabled && (pointer.type == c_ragdollPointerType) && !IsIgnored(pointer.transform) && (RagdollController.Instance != null) && !RagdollController.Instance.IsRagdolled())
if(Settings.PointersReaction && (pointer != null) && pointer.enabled && (pointer.type == c_ragdollPointerType) && !IgnoreCheck(pointer.transform) && (RagdollController.Instance != null) && !RagdollController.Instance.IsRagdolled())
RagdollController.Instance.Ragdoll();
}
public void TriggerExit(CVRPointer pointer)
{
}
// Static utility
static bool IgnoreCheck(Transform p_transform)
{
return (Settings.IgnoreLocal && (p_transform.root == PlayerSetup.Instance.transform));
}
static bool RestrictionsCheck(Transform p_transform)
{
if(p_transform == PlayerSetup.Instance.transform)
return false;
PlayerDescriptor l_playerDescriptor = p_transform.GetComponent<PlayerDescriptor>();
if(l_playerDescriptor != null)
return (!Settings.FriendsGrab || Friends.FriendsWith(l_playerDescriptor.ownerId));
return false;
}
}
}

View file

@ -114,7 +114,6 @@ namespace ml_prm
BetterBetterCharacterController.OnTeleport.AddListener(this.OnPlayerTeleport);
ModUi.OnSwitchChanged.AddListener(this.SwitchRagdoll);
RemoteGesturesManager.OnGestureState.AddListener(this.OnRemoteGestureStateChanged);
}
void OnDestroy()
@ -163,7 +162,6 @@ namespace ml_prm
BetterBetterCharacterController.OnTeleport.RemoveListener(this.OnPlayerTeleport);
ModUi.OnSwitchChanged.RemoveListener(this.SwitchRagdoll);
RemoteGesturesManager.OnGestureState.RemoveListener(this.OnRemoteGestureStateChanged);
}
void Update()
@ -305,7 +303,10 @@ namespace ml_prm
{
m_avatarTransform = PlayerSetup.Instance.AvatarTransform;
m_hips = PlayerSetup.Instance.Animator.GetBoneTransform(HumanBodyBones.Hips);
Utils.SetAvatarTPose();
IKSystem.Instance.SetAvatarPose(IKSystem.AvatarPose.TPose);
PlayerSetup.Instance.AvatarTransform.localPosition = Vector3.zero;
PlayerSetup.Instance.AvatarTransform.localRotation = Quaternion.identity;
BipedRagdollReferences l_avatarReferences = BipedRagdollReferences.FromAvatar(PlayerSetup.Instance.Animator);
@ -368,7 +369,7 @@ namespace ml_prm
if((l_body != null) && (l_collider != null))
{
RagdollBodypartHandler l_handler = l_puppetTransforms[i].gameObject.AddComponent<RagdollBodypartHandler>();
l_handler.SetInfuencerUsage(Utils.IsInEnumeration(l_puppetTransforms[i], l_influencedTransforms));
l_handler.UseBuoyancy = Utils.IsObjectInArray(l_puppetTransforms[i], l_influencedTransforms);
m_ragdollBodyHandlers.Add(l_handler);
}
@ -400,6 +401,7 @@ namespace ml_prm
foreach(RagdollBodypartHandler l_handler in m_ragdollBodyHandlers)
{
l_handler.RemovePhysicsController();
l_handler.SetAsKinematic(true);
l_handler.SetColliderMaterial(m_physicsMaterial);
}
@ -518,31 +520,6 @@ namespace ml_prm
p_result.m_result |= (m_ragdolled && (m_vrIK != null));
}
// Custom game events
void OnRemoteGestureStateChanged(ABI_RC.Core.Player.PuppetMaster p_master, RemoteGesturesManager.GestureHand p_hand, bool p_state)
{
if(m_avatarReady && m_ragdolled && Settings.GestureGrab && (p_master.Animator != null))
{
Transform l_hand = p_master.Animator.GetBoneTransform((p_hand == RemoteGesturesManager.GestureHand.Left) ? HumanBodyBones.LeftHand : HumanBodyBones.RightHand);
Transform l_finger = p_master.Animator.GetBoneTransform((p_hand == RemoteGesturesManager.GestureHand.Left) ? HumanBodyBones.LeftMiddleProximal : HumanBodyBones.RightMiddleProximal);
if(l_hand != null)
{
Vector3 l_pos = (l_finger != null) ? ((l_hand.position + l_finger.position) * 0.5f) : l_hand.position;
foreach(var l_bodyHandler in m_ragdollBodyHandlers)
{
if(p_state)
{
if(l_bodyHandler.Attach(l_hand, l_pos))
break;
}
else
l_bodyHandler.Detach(l_hand);
}
}
}
}
// VRIK updates
void OnIKPostSolverUpdate()
{

View file

@ -1,148 +0,0 @@
using ABI_RC.Core.Networking.IO.Social;
using ABI_RC.Core.Player;
using ABI_RC.Systems.GameEventSystem;
using System;
using System.Collections.Generic;
using UnityEngine;
namespace ml_prm
{
[DisallowMultipleComponent]
class RemoteGesturesManager : MonoBehaviour
{
public enum GestureHand
{
Left = 0,
Right
}
internal class GestureEvent<T1, T2, T3>
{
event Action<T1, T2, T3> m_action;
public void AddListener(Action<T1, T2, T3> p_listener) => m_action += p_listener;
public void RemoveListener(Action<T1, T2, T3> p_listener) => m_action -= p_listener;
public void Invoke(T1 p_objA, T2 p_objB, T3 p_objC) => m_action?.Invoke(p_objA, p_objB, p_objC);
}
public static readonly GestureEvent<PuppetMaster, GestureHand, bool> OnGestureState = new GestureEvent<PuppetMaster, GestureHand, bool>();
class PlayerEntry
{
public CVRPlayerEntity m_entity = null;
public PuppetMaster m_puppetMaster = null;
public bool m_stateLeft = false;
public bool m_stateRight = false;
}
static RemoteGesturesManager ms_instance = null;
readonly List<PlayerEntry> m_entries = null;
internal RemoteGesturesManager()
{
m_entries = new List<PlayerEntry>();
}
void Awake()
{
if(ms_instance != null)
{
DestroyImmediate(this);
return;
}
ms_instance = this;
DontDestroyOnLoad(this);
}
void Start()
{
CVRGameEventSystem.Player.OnJoinEntity.AddListener(OnRemotePlayerCreated);
CVRGameEventSystem.Player.OnLeaveEntity.AddListener(OnRemotePlayerDestroyed);
Settings.OnGestureGrabChanged.AddListener(OnGestureGrabChanged);
}
void OnDestroy()
{
if(ms_instance == this)
ms_instance = null;
m_entries.Clear();
CVRGameEventSystem.Player.OnJoinEntity.RemoveListener(OnRemotePlayerCreated);
CVRGameEventSystem.Player.OnLeaveEntity.RemoveListener(OnRemotePlayerDestroyed);
Settings.OnGestureGrabChanged.RemoveListener(OnGestureGrabChanged);
}
void Update()
{
if(Settings.GestureGrab)
{
foreach(var l_entry in m_entries)
{
bool l_state = l_entry.m_puppetMaster.IsLeftGrabPointerActive();
if(l_entry.m_stateLeft != l_state)
{
l_entry.m_stateLeft = l_state;
if(!Settings.FriendsGrab || Friends.FriendsWith(l_entry.m_entity.PlayerDescriptor.ownerId))
OnGestureState.Invoke(l_entry.m_puppetMaster, GestureHand.Left, l_entry.m_stateLeft);
}
l_state = l_entry.m_puppetMaster.IsRightGrabPointerActive();
if(l_entry.m_stateRight != l_state)
{
l_entry.m_stateRight = l_state;
if(!Settings.FriendsGrab || Friends.FriendsWith(l_entry.m_entity.PlayerDescriptor.ownerId))
OnGestureState.Invoke(l_entry.m_puppetMaster, GestureHand.Right, l_entry.m_stateRight);
}
}
}
}
void OnRemotePlayerCreated(CVRPlayerEntity p_player)
{
try
{
if((p_player != null) && (p_player.PuppetMaster != null))
{
PlayerEntry l_entry = new PlayerEntry()
{
m_entity = p_player,
m_puppetMaster = p_player.PuppetMaster,
m_stateLeft = false,
m_stateRight = false
};
m_entries.Add(l_entry);
}
}
catch(Exception e)
{
MelonLoader.MelonLogger.Error(e);
}
}
void OnRemotePlayerDestroyed(CVRPlayerEntity p_player)
{
try
{
if(p_player != null)
m_entries.RemoveAll(e => ReferenceEquals(e.m_puppetMaster, p_player.PuppetMaster));
}
catch(Exception e)
{
MelonLoader.MelonLogger.Error(e);
}
}
void OnGestureGrabChanged(bool p_state)
{
if(!p_state)
{
foreach(var l_entry in m_entries)
{
l_entry.m_stateLeft = false;
l_entry.m_stateRight = false;
}
}
}
}
}

View file

@ -35,8 +35,7 @@ namespace ml_prm
FallDamage,
FallLimit,
GestureGrab,
FriendsGrab,
GrabDistance
FriendsGrab
}
public static bool Hotkey { get; private set; } = true;
@ -111,8 +110,7 @@ namespace ml_prm
ms_category.CreateEntry(ModSetting.FallDamage.ToString(), FallDamage, null, null, true),
ms_category.CreateEntry(ModSetting.FallLimit.ToString(), FallLimit, null, null, true),
ms_category.CreateEntry(ModSetting.GestureGrab.ToString(), GestureGrab, null, null, true),
ms_category.CreateEntry(ModSetting.FriendsGrab.ToString(), FriendsGrab, null, null, true),
ms_category.CreateEntry(ModSetting.GrabDistance.ToString(), GrabDistance, null, null, true),
ms_category.CreateEntry(ModSetting.FriendsGrab.ToString(), FriendsGrab, null, null, true)
};
ms_entries[(int)ModSetting.HotkeyKey].OnEntryValueChangedUntyped.Subscribe(OnMelonSettingSave_HotkeyKey);
@ -137,7 +135,6 @@ namespace ml_prm
FallLimit = Mathf.Clamp((float)ms_entries[(int)ModSetting.FallLimit].BoxedValue, 4.5f, 44.5f);
GestureGrab = (bool)ms_entries[(int)ModSetting.GestureGrab].BoxedValue;
FriendsGrab = (bool)ms_entries[(int)ModSetting.FriendsGrab].BoxedValue;
GrabDistance = Mathf.Clamp01((float)ms_entries[(int)ModSetting.GrabDistance].BoxedValue);
}
static void OnMelonSettingSave_HotkeyKey(object p_oldValue, object p_newValue)
@ -296,13 +293,6 @@ namespace ml_prm
OnFallLimitChanged.Invoke(FallLimit);
}
break;
case ModSetting.GrabDistance:
{
GrabDistance = (float)p_value;
OnGrabDistanceChanged.Invoke(GrabDistance);
}
break;
}
if(ms_entries != null)

View file

@ -7,7 +7,6 @@ using System.Collections.Generic;
using System.Reflection;
using UnityEngine;
using System.Linq;
using ABI_RC.Systems.IK.SubSystems;
using ABI_RC.Core.InteractionSystem;
namespace ml_prm
@ -22,12 +21,6 @@ namespace ml_prm
public static void ClearFluidVolumes(this BetterBetterCharacterController p_instance) => (ms_touchingVolumes?.GetValue(p_instance) as List<FluidVolume>)?.Clear();
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 bool IsReady(this PhysicsInfluencer p_instance)
{
return ((ms_referencePoints.GetValue(p_instance) as List<Vector3>).Count > 0);
@ -38,27 +31,15 @@ namespace ml_prm
(ms_influencerSubmergedColliders.GetValue(p_instance) as Dictionary<FluidVolume, int>)?.Clear();
}
public static void SetAvatarTPose()
{
IKSystem.Instance.SetAvatarPose(IKSystem.AvatarPose.TPose);
PlayerSetup.Instance.AvatarTransform.localPosition = Vector3.zero;
PlayerSetup.Instance.AvatarTransform.localRotation = Quaternion.identity;
}
public static bool IsInEnumeration(object p_obj, object[] p_enumeration) => p_enumeration.Contains(p_obj);
public static bool IsLeftGrabPointerActive(this PuppetMaster p_source)
{
return p_source._playerAvatarMovementDataCurrent.IsLeftHandGrabbing();
}
public static bool IsRightGrabPointerActive(this PuppetMaster p_source)
{
return p_source._playerAvatarMovementDataCurrent.IsRightHandGrabbing();
}
public static bool IsObjectInArray(object p_obj, object[] p_enumeration) => p_enumeration.Contains(p_obj);
public static CVRSeat GetCurrentSeat(this BetterBetterCharacterController p_instance) => (ms_lastCVRSeat?.GetValue(p_instance) as CVRSeat);
public static bool IsInRange(float p_value, float p_min, float p_max) => ((p_min <= p_value) && (p_value <= p_max));
// Unity specific
public static void CopyGlobal(this Transform p_source, Transform p_target)
{
p_target.position = p_source.position;
p_target.rotation = p_source.rotation;
}
}
}