game(interaction/drawer): UNCORRUPTED?

FINALLY?
This commit is contained in:
Mark Joshwel 2025-02-09 20:24:02 +08:00
parent bb2c744344
commit 362094b914
7 changed files with 5249 additions and 39 deletions

File diff suppressed because one or more lines are too long

View file

@ -1 +1,7 @@
Г4Ж2Ѓ7ЙЖ0:Ћ2ЙЙД77<19>ГК42<19><1A>Б<EFBFBD><1A>А1<D090>3<1C>213<31>ВБВ<>1(Й2Г0БЄ6И79К29<10>2<К29З0Ж'1ЕВ1К9<1D>Н><10>КЙ29Ђ0К0<10>АЙЙ2:Ё:72Ж2ЇАЖ2<10>АЙЙ2:Ё:72Ж2Ћ0ЙД07: fileFormatVersion: 2
guid: 2052c55ff54ac834f86e6bf8ec94d3c2
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because one or more lines are too long

View file

@ -1 +1,7 @@
Г4Ж2Ѓ7ЙЖ0:Ћ2ЙЙД77<19>ГК422В<18>ГВГ1<1A>В<>А0Б<>2121(Й2Г0БЄ6И79К29<10>2<К29З0Ж'1ЕВ1К9<1D>Н><10>КЙ29Ђ0К0<10>АЙЙ2:Ё:72Ж2ЇАЖ2<10>АЙЙ2:Ё:72Ж2Ћ0ЙД07: fileFormatVersion: 2
guid: d6d1294f3d7f3b4438d5aa264b3eb4db
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -1,6 +1,6 @@
%YAML 1.1 %YAML 1.1
%TAG !u! tag:unity3d.com,2011: %TAG !u! tag:unity3d.com,2011:
--- !u!1 &2785014689676826087 --- !u!1 &2241004988363710587
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0} m_CorrespondingSourceObject: {fileID: 0}
@ -8,54 +8,66 @@ GameObject:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
serializedVersion: 6 serializedVersion: 6
m_Component: m_Component:
- component: {fileID: 7548123659046493114} - component: {fileID: 9062581398314777105}
- component: {fileID: 9107066153244540908} - component: {fileID: 6622534912770032937}
- component: {fileID: 2929167475790662953} - component: {fileID: 185535121731533047}
- component: {fileID: 3082934515490353905} - component: {fileID: 4570066915066746684}
- component: {fileID: 1033763107808798454}
m_Layer: 10 m_Layer: 10
m_Name: Drawer Interactable (Dynamic Component) m_Name: Handle Surface
m_TagString: Untagged m_TagString: Untagged
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
m_StaticEditorFlags: 0 m_StaticEditorFlags: 0
m_IsActive: 1 m_IsActive: 1
--- !u!4 &7548123659046493114 --- !u!4 &9062581398314777105
Transform: Transform:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0} m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2785014689676826087} m_GameObject: {fileID: 2241004988363710587}
serializedVersion: 2 serializedVersion: 2
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
m_Children: [] m_Children: []
m_Father: {fileID: 0} m_Father: {fileID: 7548123659046493114}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &9107066153244540908 --- !u!54 &6622534912770032937
Rigidbody:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2241004988363710587}
serializedVersion: 4
m_Mass: 1
m_Drag: 0
m_AngularDrag: 0.05
m_CenterOfMass: {x: 0, y: 0, z: 0}
m_InertiaTensor: {x: 1, y: 1, z: 1}
m_InertiaRotation: {x: 0, y: 0, z: 0, w: 1}
m_IncludeLayers:
serializedVersion: 2
m_Bits: 0
m_ExcludeLayers:
serializedVersion: 2
m_Bits: 0
m_ImplicitCom: 1
m_ImplicitTensor: 1
m_UseGravity: 1
m_IsKinematic: 0
m_Interpolate: 0
m_Constraints: 0
m_CollisionDetection: 0
--- !u!114 &185535121731533047
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0} m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2785014689676826087} m_GameObject: {fileID: 2241004988363710587}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: da315c3f1e28be241badd4ee9c4b6e76, type: 3}
m_Name:
m_EditorClassIdentifier:
movementAxis: 1
maxMovementDistance: 0.5
--- !u!114 &2929167475790662953
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2785014689676826087}
m_Enabled: 1 m_Enabled: 1
m_EditorHideFlags: 0 m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 0ad34abafad169848a38072baa96cdb2, type: 3} m_Script: {fileID: 11500000, guid: 0ad34abafad169848a38072baa96cdb2, type: 3}
@ -171,6 +183,70 @@ MonoBehaviour:
m_StartingMultipleGrabTransformers: [] m_StartingMultipleGrabTransformers: []
m_AddDefaultGrabTransformers: 1 m_AddDefaultGrabTransformers: 1
m_FarAttachMode: 0 m_FarAttachMode: 0
--- !u!138 &4570066915066746684
FixedJoint:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2241004988363710587}
m_ConnectedBody: {fileID: 3082934515490353905}
m_ConnectedArticulationBody: {fileID: 0}
m_BreakForce: Infinity
m_BreakTorque: Infinity
m_EnableCollision: 0
m_EnablePreprocessing: 1
m_MassScale: 1
m_ConnectedMassScale: 1
--- !u!1 &2785014689676826087
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 7548123659046493114}
- component: {fileID: 9107066153244540908}
- component: {fileID: 3082934515490353905}
- component: {fileID: 1033763107808798454}
m_Layer: 10
m_Name: Drawer Interactable (Dynamic Component)
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &7548123659046493114
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2785014689676826087}
serializedVersion: 2
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 9062581398314777105}
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &9107066153244540908
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2785014689676826087}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: da315c3f1e28be241badd4ee9c4b6e76, type: 3}
m_Name:
m_EditorClassIdentifier:
movementAxis: 1
maxMovementDistance: 0.5
--- !u!54 &3082934515490353905 --- !u!54 &3082934515490353905
Rigidbody: Rigidbody:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

File diff suppressed because one or more lines are too long

View file

@ -1,27 +1,56 @@
using System; using System;
using UnityEngine; using UnityEngine;
º¹4·3<EFBFBD>*·4º¼"·³4·2,)—$7º2¹°1º´77ª·7¶µ4:—$7º2¹°1º01¶²¹<C2B2>…-©²¸º4¹²¡·6¸7·27:º<¸²73,©#¹0±$7º2¹°1º01¶²””®…-©²¸º4¹²¡·6¸7·27:º<¸²73”¡77³´³:¹01¶2¥·47º””® using UnityEngine.XR.Interaction.Toolkit.Interactables;
[RequireComponent(typeof(XRGrabInteractable))]
[RequireComponent(typeof(ConfigurableJoint))]
public class DrawerDynamicJointConfiguration : MonoBehaviour 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" + [HelpBox("make sure every child inside both prefabs are under the" +
"'Interactable Environment' layer.\n\n" + "'Interactable Environment' layer.\n\n" +
;´0º2»29·7·9º07²09200(¹7¡º46²2¹<EFBFBD>71µ²1:<EFBFBD>³²·2:¹<<EFBFBD>:7²29:´2<EFBFBD>47º2¹°1º0128¹2³01<EFBFBD>9´·:62´0»2<EFBFBD>0<EFBFBD>±77»2<<EFBFBD>²94<EFBFBD>±764²29<EFBFBD>43:´2<EFBFBD>±7·¹72·°³9<EFBFBD>0±·::<EFBFBD>4º.7.7<EFBFBD>0·<<EFBFBD>¡:9»2<EFBFBD>$7º2¹°1º´77<EFBFBD>¡°9º2¹900<EFBFBD>,)<EFBFBD>'¹´³47+©<EFBFBD>¡°2¹0<EFBFBD>'3³¹2º<EFBFBD><EFBFBD>¡77:¹762¹<EFBFBD><EFBFBD>§²0¹£09<EFBFBD>$7º2¹°1º7¹<EFBFBD>¡:9»2<EFBFBD>$7º2¹°1º´77<EFBFBD>¡°9º2¹<EFBFBD>9´·:62±2´0»2:´2<EFBFBD>$7º2¹°1º012<EFBFBD>"7»4¹7·¶27º¶°¼29<32>4·1¶:²22<32>47<34>4º¹©°¼±°9:<3A>¦°¹5 HelpBoxMessageType.Error)] "whatever non-standard (a la ProBuilder) object geometry under the " +
"interactable prefab should have a convex mesh collider if the console nags about it!\n\n" +
"any Curve Interaction Casters (a la 'XR Origin (VR)' > 'Camera Offset' > '... Controller' " +
"> 'Near-Far Interactor' > 'Curve Interaction Caster') should be have the " +
"'Interactable Environment' layer included in its' Raycast Mask.",
HelpBoxMessageType.Error)]
[Space(10)] [Space(10)]
[SerializeField] [SerializeField]
private MovementAxis movementAxis = MovementAxis.Z; private MovementAxis movementAxis = MovementAxis.Z;
ž¹º0¹<Ÿ<EFBFBD>:´2<EFBFBD>0¼´º6²´9º0·±2:´22¹°»29<EFBFBD>±07±2¸:622<EFBFBD>·:º<EFBFBD>ž¹º0¹<Ÿ<EFBFBD>-ª·76º48:´2<EFBFBD>0¼´º6²´9º0·±2:´22¹°»29<EFBFBD>±07±2¸:622<EFBFBD>·::.<EFBFBD>­©2¹´04½2£´26²®8¹4»0º23·0:<EFBFBD>0¼¦7»²27:¢´9º0·±2<EFBFBD>³<EFBFBD><EFBFBD>ž¹º0¹<Ÿ<EFBFBD>:´2»2·±4º<<EFBFBD>¹±02<EFBFBD>73:´22¹°»29´·;³°9:<EFBFBD>4:<EFBFBD>±07<EFBFBD>7»²<EFBFBD>ž¹º0¹<Ÿ<EFBFBD>-ª·76º48:´2»2·±4º<<EFBFBD>¹±02<EFBFBD>73:´22¹°»29´·;³°9:<EFBFBD>4:<EFBFBD>±07<EFBFBD>7»2.<EFBFBD>­©2¹´04½2£´26²®8¹4»0º23·0:»2·±4º¼©±02<EFBFBD>³<EFBFBD> /// <summary>
/// the maximum distance the drawer can be pulled out
/// </summary>
[Tooltip("the maximum distance the drawer can be pulled out")] [SerializeField]
private float maxMovementDistance = 0.5f;
/// <summary>
/// the velocity scale of the drawer, how fast it can move
/// </summary>
[Tooltip("the velocity scale of the drawer, how fast it can move")] [SerializeField]
private float velocityScale = 0.5f;
private void Awake() private void Awake()
{ {
// ±77³´³:¹2:´2 configurable joint component // configure the configurable joint component
var cJoint = GetComponent<ConfigurableJoint>(); var cJoint = GetComponent<ConfigurableJoint>();
if (cJoint == null) if (cJoint == null)
throw new Exception("Drawer (Dynamic): ConfigurableJoint component not found ”:7¹²°1´01¶²Ÿ"); throw new Exception("Drawer (Dynamic): ConfigurableJoint component not found (unreachable?)");
<EFBFBD>·±5<EFBFBD>066<EFBFBD>7º´7·94·²09<EFBFBD>072<EFBFBD>0·³:0¹<EFBFBD>2¼±28:³79:´2²²¹4¹224·²0¹<EFBFBD>0¼´¹¢2±º3¦·3"¹°»29¢<·°¶´±¶·±µ4·3<C2B7>¶7»²¶27:º7<C2BA>´9<C2B4>½¶7»²¶27º ¼´¹><E28098><10>1¥·47:¼¦7º´77<37><1E>¶7»²¶27º ¼´9<C2B4>ž<1E>¦7»²¶27º ¼´9¬<10><1F>¡77³´³:¹01¶2¥·47º¦7º´77¦´¶4º2²<1D>¡77³´³:¹01¶2¥·47º¦7º´77¦·±µ2²<32><10>1¥·47:—¼¦7º´77<37><1E>¶7»²¶27º ¼´9<C2B4>ž<1E>¦7»²¶27º ¼´9—¬<10><1F>¡77³´³:¹01¶2¥·47º¦7º´77¦´¶4º2²<1D>¡77³´³:¹01¶2¥·47º¦7º´77¦·±µ2²<32><10>1¥·47:½¦7º´77<37><1E>¶7»²¶27º ¼´9<C2B4>ž<1E>¦7»²¶27º ¼´9­<10><1F>¡77³´³:¹01¶2¥·47º¦7º´77¦´¶4º2²<1D>¡77³´³:¹01¶2¥·47º¦7º´77¦·±µ2²<32> cJoint.angularXMotion = ConfigurableJointMotion.Locked; // lock all motions (linear and angular) except for the desired (linear) axis
Debug.Log($"Drawer (Dynamic): locking movement to axis {movementAxis}");
cJoint.xMotion = movementAxis == MovementAxis.X
? ConfigurableJointMotion.Limited
: ConfigurableJointMotion.Locked;
cJoint.yMotion = movementAxis == MovementAxis.Y
? ConfigurableJointMotion.Limited
: ConfigurableJointMotion.Locked;
cJoint.zMotion = movementAxis == MovementAxis.Z
? ConfigurableJointMotion.Limited
: ConfigurableJointMotion.Locked;
cJoint.angularXMotion = ConfigurableJointMotion.Locked;
cJoint.angularYMotion = ConfigurableJointMotion.Locked; cJoint.angularYMotion = ConfigurableJointMotion.Locked;
cJoint.angularZMotion = ConfigurableJointMotion.Locked; cJoint.angularZMotion = ConfigurableJointMotion.Locked;
@ -32,7 +61,19 @@ public class DrawerDynamicJointConfiguration : MonoBehaviour
bounciness = 0, bounciness = 0,
contactDistance = 0 contactDistance = 0
}; };
<EFBFBD><EFBFBD><EFBFBD>±77³´³:¹2:´2¹´³42±7²¼»0991<EFBFBD><EFBFBD>£2º¡·6¸7·27:©´³42±7²<<EFBFBD>91´¹¥4·²0º´1<EFBFBD>³0¹²<EFBFBD>91º¹²#¹0»4º<<EFBFBD>³0¹²<EFBFBD>91±76´¹´77¢2º²1º´7·¦7²2<EFBFBD><EFBFBD>¡76´¹´77¢2º²1º´7·¦7²2¡77º4·º·º9¢<·°´±<EFBFBD><EFBFBD><EFBFBD>±77³´³:¹2:´2<EFBFBD>3¹01<EFBFBD>47º2¹°1º01²»09<EFBFBD>3¹0±$7º2¹°1º012<EFBFBD><EFBFBD>£2º¡·6¸7·27:,©#¹0±$7º2¹°1º012<EFBFBD><EFBFBD>3¹0±$7º2¹°1º0127»²27:ª<¸2<EFBFBD>,)¡°¹²$7º2¹°1º012¦7»²27:ª<¸2«2·±4º<*¹°±µ4·³<EFBFBD><EFBFBD>3¹0±$7º2¹°1º012:¹°±5¨·¹4º´77<EFBFBD>:¹º²<EFBFBD><EFBFBD>3¹0±$7º2¹°1º012»2·±4º¼©±02<EFBFBD>»2·±4º¼©±0²<EFBFBD>
// configure the rigidbody
var rb = GetComponent<Rigidbody>();
rb.isKinematic = false;
rb.useGravity = false;
rb.collisionDetectionMode = CollisionDetectionMode.ContinuousDynamic;
// configure the grab interactable
var grabInteractable = GetComponent<XRGrabInteractable>();
grabInteractable.movementType = XRBaseInteractable.MovementType.VelocityTracking;
grabInteractable.trackPosition = true;
grabInteractable.velocityScale = velocityScale;
// guess the handle collider, lol // guess the handle collider, lol
Collider drawerDoorHandleCollider = GetComponentInChildren<BoxCollider>(); Collider drawerDoorHandleCollider = GetComponentInChildren<BoxCollider>();
if (drawerDoorHandleCollider == null) if (drawerDoorHandleCollider == null)