if (m_Subsystem != null) m_Subsystem.updatedHands += OnHandUpdate; }
voidOnHandUpdate(XRHandSubsystem subsystem, XRHandSubsystem.UpdateSuccessFlags updateSuccessFlags, XRHandSubsystem.UpdateType updateType) { switch (updateType) { case XRHandSubsystem.UpdateType.Dynamic: // Update game logic that uses hand data break; case XRHandSubsystem.UpdateType.BeforeRender: for (var i = XRHandJointID.BeginMarker.ToIndex(); i < XRHandJointID.EndMarker.ToIndex(); i++) { var trackingData = subsystem.rightHand .GetJoint(XRHandJointIDUtility.FromIndex(i));
if (trackingData.TryGetPose(out Pose pose)) { // displayTransform is some GameObject's Transform component Debug.Log($"[{nameof(XRHand)}]Joint{i} : {nameof(Position)}{pose.position} | {nameof(Rotate)}{pose.rotation}"); } } break; } }
General settings container used to house the instance of the active settings as well as the manager instance used to load the loaders with.
XR Loader abstract class used as a base class for specific provider implementations. Providers should implement subclasses of this to provide specific initialization and management implementations that make sense for their supported scenarios and needs.
${\pmb{R}^3 = }$ all vectors with 3 real components.
${\pmb{R}^n = }$ all vectors with n real components.
When the object undergoes deformation, every material point $\vec{X}$ is being displaced to a new deformed location which is, by convention, denoted by a lowercase variable $\vec{x}$ The relation between each material point and its deformation function $\vec{\phi} : R^{3} \rightarrow R^{3} $. $$ \vec{x} = \vec{\phi}(\vec{X})·1 $$ An important physical quantity derived directly from $\vec{\phi}(\vec{X})$, is the deformation gradient tensor ${ \pmb{F} \in \pmb{R^{3\times3}}}$
If we write ${\vec{X} = (X_1,X_2,X_3)^T} or{\vec{X} = (X,Y,Z)^T} $ and ${\vec{\phi}(\vec{X}) = (\vec{\phi_1}(\vec{X}),\vec{\phi_2}(\vec{X}),\vec{\phi_3}(\vec{X}))^T}$
注意是原每一组点根据三个对应关系被分别转换到三个分量上
for the three components of the vector-valued function ${\vec{\phi}}$, the deformation gradient is written as: $$ \pmb{F}:= \frac{\partial(\phi_1,\phi_2,\phi_3)}{\partial({X_1,X_2,X_3})} = \left( \begin{matrix}\frac{\partial\phi_1}{\partial X_1} & \frac{\partial\phi_1}{\partial X_2} & \frac{\partial\phi_1}{\partial X_3}\ \frac{\partial\phi_2}{\partial X_1} & \frac{\partial\phi_2}{\partial X_2} & \frac{\partial\phi_2}{\partial X_3}\ \frac{\partial\phi_3}{\partial X_1} & \frac{\partial\phi_3}{\partial X_2} & \frac{\partial\phi_3}{\partial X_3}\end{matrix}\right) $$ or, in index notation ${ F_{ij} = \phi_{i,j} }$ . In simple terms, the deformation gradient measures the amount of change in shape and size of a material body relative to its original configuration. The magnitude of the deformation gradient can be used to determine the amount of deformation or strain that has occurred, and its orientation can be used to determine the direction of deformation.
Note that, in general, $\pmb{F}$ will be spatially varying across ${\Omega}$, which is the volumetric domain occupied by the object. This domain will be referred to as the reference(or undefined configuration)
Strain energy and hyperelasticity
One of the consequences of elastic deformation is the accumulation of potential energy in the deformed body, which is referred to as strain energy ${E[\phi]}$ in the context of deformable solids. It is suggested that the energy is fully determined by the deformation map of a given configuration.
However intuitive, this statement nevertheless reflects a significant hypothesis that led to this formulation: we have assumed that the potential energy associated with a deformed configuration only depends on the final deformed shape, and not on the deformation path over time that brought the body into its current configuration.
The independence of the strain energy on the prior deformation history is a characteristic property of so-called hyperelastic materials. This property of is closely related with the fact that elastic forces of hyperelastic materials are conservative: the total work done by the internal elastic forces in a deformation path depends solely on the initial and final configurations, not the path itself.
Different parts of a deforming body undergo shape changes of different severity. As a consequence, the relation between deformation and strain energy is better defined on a local scale. We achieve that by introducing an energy density function ${\Psi[\phi;\vec{X}]}$ which measures the strain energy per unit undeformed volume on an infinitesimal domain ${dV}$ around the material point $\vec{X}$. We can then obtain the total energy for the deforming body by integrating the energy density function over the entire domain ${\Omega}$: $$ E[\phi] = \int_\Omega\Psi[\phi;\vec{X}]d\vec{X} $$
Virtual reality (VR) is a simulated experience that employs pose tracking and 3D near-eye displays to give the user an immersive feel of a virtual world.
publicclassDragManager: SingletonForMonobehaviour<DragManager> { //首先声明Interactor类,并在U public XRDirectInteractor leftDirectInteractor; public XRRayInteractor leftRayInteractor;
- CommonUsages.triggerButton: represents whether the Trigger button has been activated (pressed). - CommonUsages.trigger: represents the degree to which the Trigger button was pressed. For example, in an archery game, it represents how full the bow has been drawn.
Grip
- CommonUsages.gripButton: represents whether the Grip button has been activated (pressed). - CommonUsages.grip: represents the degree to which the Grip button was pressed. For example, in an archery game, it represents how full the bow has been drawn.
using System; using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.XR; using Common; ///<summary> /// 提供各种输入事件 ///</summary> publicclassInputEvent:MonoSingleton<InputEvent> { //*************输入设别************************** InputDevice leftHandController; InputDevice rightHandController; InputDevice headController;
//**************对外提供公开事件****************** #region public event
public Action onLeftTriggerEnter; public Action onLeftTriggerDown; public Action onLeftTriggerUp;
public Action onRightTriggerEnter; public Action onRightTriggerDown; public Action onRightTriggerUp;
public Action onLeftGripEnter; public Action onLeftGripDown; public Action onLeftGripUp;
public Action onRightGripEnter; public Action onRightGripDown; public Action onRightGripUp;
public Action onLeftAppButtonEnter; public Action onLeftAppButtonDown; public Action onLeftAppButtonUp;
public Action onRightAppButtonEnter; public Action onRightAppButtonDown; public Action onRightAppButtonUp;
public Action onLeftJoyStickEnter; public Action onLeftJoyStickDown; public Action onLeftJoyStickUp;
public Action onRightJoyStickEnter; public Action onRightJoyStickDown; public Action onRightJoyStickUp;
public Action<Vector2> onLeftJoyStickMove; public Action<Vector2> onRightJoyStickMove;
public Action onLeftAXButtonEnter; public Action onLeftAXButtonDown; public Action onLeftAXButtonUp;
public Action onLeftBYButtonEnter; public Action onLeftBYButtonDown; public Action onLeftBYButonUp;
public Action onRightAXButtonEnter; public Action onRightAXButtonDown; public Action onRightAXButtonUp;
public Action onRightBYButtonEnter; public Action onRightBYButtonDown; public Action onRightBYButtonUp;