港铁 2.7.3 对象操纵器.cs pointerIdToPointerMap.Add(id, new PointerData(eventData.Pointer, eventData.Pointer.Result.Details.Point)); 这两个指针是什么意思? 1、eventData.Pointer 2、eventData.Pointer.Result.Details.Point
enter code here
public void OnPointerDown(MixedRealityPointerEventData eventData)
{
if (eventData.used ||
(!allowFarManipulation && eventData.Pointer as IMixedRealityNearPointer == null))
{
return;
}
// If we only allow one handed manipulations, check there is no hand interacting yet.
if (manipulationType != ManipulationHandFlags.OneHanded || pointerIdToPointerMap.Count == 0)
{
uint id = eventData.Pointer.PointerId;
// Ignore poke pointer events
if (!pointerIdToPointerMap.ContainsKey(id))
{
// cache start ptr grab point
pointerIdToPointerMap.Add(id, new PointerData(eventData.Pointer, eventData.Pointer.Result.Details.Point));
// Re-initialize elastic systems.
if (elasticsManager)
{
elasticsManager.InitializeElastics(HostTransform);
}
// Call manipulation started handlers
if (IsTwoHandedManipulationEnabled)
{
if (!isManipulationStarted)
{
HandleManipulationStarted();
}
HandleTwoHandManipulationStarted();
}
else if (IsOneHandedManipulationEnabled)
{
if (!isManipulationStarted)
{
HandleManipulationStarted();
}
HandleOneHandMoveStarted();
}
}
}
if (pointerIdToPointerMap.Count > 0)
{
// Always mark the pointer data as used to prevent any other behavior to handle pointer events
// as long as the ObjectManipulator is active.
// This is due to us reacting to both "Select" and "Grip" events.
eventData.Use();
}
}
enter code here
private struct PointerData
{
public IMixedRealityPointer pointer;
private Vector3 initialGrabPointInPointer;
public PointerData(IMixedRealityPointer pointer, Vector3 worldGrabPoint) : this()
{
this.pointer = pointer;
this.initialGrabPointInPointer = Quaternion.Inverse(pointer.Rotation) * (worldGrabPoint - pointer.Position);
}
public bool IsNearPointer => pointer is IMixedRealityNearPointer;
/// Returns the grab point on the manipulated object in world space
public Vector3 GrabPoint => (pointer.Rotation * initialGrabPointInPointer) + pointer.Position;
}
我很想知道答案