game(scripts): standardise DrawerDynamicJointConfiguration

This commit is contained in:
Mark Joshwel 2025-02-14 22:18:17 +08:00
parent d326e662dd
commit 71b7a3b919

View file

@ -1,3 +1,9 @@
/*
* Author: Mark
* Date: 31/1/2025
* Description: Dynamic configuration script for a drawer interactable
*/
using System; using System;
using UnityEngine; using UnityEngine;
using UnityEngine.XR.Interaction.Toolkit.Interactables; using UnityEngine.XR.Interaction.Toolkit.Interactables;
@ -8,14 +14,16 @@ public class DrawerDynamicJointConfiguration : MonoBehaviour
{ {
[Header("mark's all-in-one dynamic drawer component")] [Header("mark's all-in-one dynamic drawer component")]
[Space(10)] [Space(10)]
[HelpBox("make sure every child inside both prefabs are under the" + #if UNITY_EDITOR
"'Interactable Environment' layer.\n\n" + [HelpBox("make sure every child inside both prefabs are under the" +
"whatever non-standard (a la ProBuilder) object geometry under the " + "'Interactable Environment' layer.\n\n" +
"interactable prefab should have a convex mesh collider if the console nags about it!\n\n" + "whatever non-standard (a la ProBuilder) object geometry under the " +
"any Curve Interaction Casters (a la 'XR Origin (VR)' > 'Camera Offset' > '... Controller' " + "interactable prefab should have a convex mesh collider if the console nags about it!\n\n" +
"> 'Near-Far Interactor' > 'Curve Interaction Caster') should be have the " + "any Curve Interaction Casters (a la 'XR Origin (VR)' > 'Camera Offset' > '... Controller' " +
"'Interactable Environment' layer included in its' Raycast Mask.", "> 'Near-Far Interactor' > 'Curve Interaction Caster') should be have the " +
HelpBoxMessageType.Error)] "'Interactable Environment' layer included in its' Raycast Mask.",
HelpBoxMessageType.Error)]
#endif
[Space(10)] [Space(10)]
[SerializeField] [SerializeField]
private MovementAxis movementAxis = MovementAxis.Z; private MovementAxis movementAxis = MovementAxis.Z;
@ -61,7 +69,7 @@ public class DrawerDynamicJointConfiguration : MonoBehaviour
bounciness = 0, bounciness = 0,
contactDistance = 0 contactDistance = 0
}; };
// configure the rigidbody // configure the rigidbody
var rb = GetComponent<Rigidbody>(); var rb = GetComponent<Rigidbody>();
rb.isKinematic = false; rb.isKinematic = false;