Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
101 changes: 50 additions & 51 deletions UnityProjects/MRTKDevTemplate/Assets/Prefabs/Whiteboard/pen.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ GameObject:
m_Component:
- component: {fileID: 2002339756}
- component: {fileID: 2002339758}
- component: {fileID: 2002339757}
- component: {fileID: 1066413309105225662}
- component: {fileID: 2002339759}
m_Layer: 0
m_Name: Pen Interactor
Expand All @@ -26,13 +26,13 @@ Transform:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2002339755}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: -0.0123}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 2415827607033482817}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &2002339758
MonoBehaviour:
Expand All @@ -47,11 +47,9 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
m_InteractionManager: {fileID: 0}
m_InteractionLayerMask:
serializedVersion: 2
m_Bits: 4294967295
m_InteractionLayers:
m_Bits: 4294967295
m_Handedness: 0
m_AttachTransform: {fileID: 0}
m_KeepSelectedTargetValid: 1
m_DisableVisualsWhenBlockedInGroup: 1
Expand All @@ -71,42 +69,51 @@ MonoBehaviour:
m_Calls: []
m_StartingHoverFilters: []
m_StartingSelectFilters: []
m_OnHoverEntered:
m_PersistentCalls:
m_Calls: []
m_OnHoverExited:
m_PersistentCalls:
m_Calls: []
m_OnSelectEntered:
m_PersistentCalls:
m_Calls: []
m_OnSelectExited:
m_PersistentCalls:
m_Calls: []
--- !u!135 &2002339757
SphereCollider:
--- !u!136 &1066413309105225662
CapsuleCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2002339755}
m_Material: {fileID: 0}
m_IncludeLayers:
serializedVersion: 2
m_Bits: 0
m_ExcludeLayers:
serializedVersion: 2
m_Bits: 0
m_LayerOverridePriority: 0
m_IsTrigger: 1
m_ProvidesContacts: 0
m_Enabled: 1
serializedVersion: 2
m_Radius: 0.0005
m_Center: {x: 0, y: 0, z: 0.0004}
m_Height: 0.003
m_Direction: 2
m_Center: {x: 0, y: 0, z: 0.0008}
--- !u!54 &2002339759
Rigidbody:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2002339755}
serializedVersion: 2
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: 1
m_Interpolate: 0
Expand Down Expand Up @@ -140,14 +147,14 @@ Transform:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3084243108605482235}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -0, y: 0, z: 0.333}
m_LocalScale: {x: 8, y: 8, z: 8}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 2002339756}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!33 &1596919684305715684
MeshFilter:
Expand Down Expand Up @@ -209,8 +216,17 @@ CapsuleCollider:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3084243108605482235}
m_Material: {fileID: 0}
m_IncludeLayers:
serializedVersion: 2
m_Bits: 0
m_ExcludeLayers:
serializedVersion: 2
m_Bits: 0
m_LayerOverridePriority: 0
m_IsTrigger: 0
m_ProvidesContacts: 0
m_Enabled: 1
serializedVersion: 2
m_Radius: 0.0015
m_Height: 0.025
m_Direction: 2
Expand All @@ -229,13 +245,11 @@ MonoBehaviour:
m_EditorClassIdentifier:
m_InteractionManager: {fileID: 0}
m_Colliders: []
m_InteractionLayerMask:
serializedVersion: 2
m_Bits: 4294967295
m_InteractionLayers:
m_Bits: 1
m_DistanceCalculationMode: 1
m_SelectMode: 0
m_FocusMode: 1
m_CustomReticle: {fileID: 0}
m_AllowGazeInteraction: 0
m_AllowGazeSelect: 0
Expand Down Expand Up @@ -268,42 +282,27 @@ MonoBehaviour:
m_SelectExited:
m_PersistentCalls:
m_Calls: []
m_Activated:
m_PersistentCalls:
m_Calls: []
m_Deactivated:
m_PersistentCalls:
m_Calls: []
m_StartingHoverFilters: []
m_StartingSelectFilters: []
m_StartingInteractionStrengthFilters: []
m_OnFirstHoverEntered:
m_PersistentCalls:
m_Calls: []
m_OnLastHoverExited:
m_PersistentCalls:
m_Calls: []
m_OnHoverEntered:
m_PersistentCalls:
m_Calls: []
m_OnHoverExited:
m_FirstFocusEntered:
m_PersistentCalls:
m_Calls: []
m_OnSelectEntered:
m_LastFocusExited:
m_PersistentCalls:
m_Calls: []
m_OnSelectExited:
m_FocusEntered:
m_PersistentCalls:
m_Calls: []
m_OnSelectCanceled:
m_FocusExited:
m_PersistentCalls:
m_Calls: []
m_OnActivate:
m_Activated:
m_PersistentCalls:
m_Calls: []
m_OnDeactivate:
m_Deactivated:
m_PersistentCalls:
m_Calls: []
m_StartingHoverFilters: []
m_StartingSelectFilters: []
m_StartingInteractionStrengthFilters: []
isGazePinchSelected:
active: 0
onEntered:
Expand Down Expand Up @@ -418,6 +417,7 @@ MonoBehaviour:
hostTransform: {fileID: 2415827607033482817}
allowedManipulations: 3
allowedInteractionTypes: 1
rigidbodyMovementType: 0
applyTorque: 1
springForceSoftness: 0.1
springTorqueSoftness: 0.1
Expand All @@ -440,8 +440,7 @@ MonoBehaviour:
moveLogicType:
reference: MixedReality.Toolkit.SpatialManipulation.MoveLogic, MixedReality.Toolkit.SpatialManipulation
rotateLogicType:
reference: MixedReality.Toolkit.SpatialManipulation.RotateLogic,
MixedReality.Toolkit.SpatialManipulation
reference: MixedReality.Toolkit.SpatialManipulation.RotateLogic, MixedReality.Toolkit.SpatialManipulation
scaleLogicType:
reference: MixedReality.Toolkit.SpatialManipulation.ScaleLogic, MixedReality.Toolkit.SpatialManipulation
--- !u!114 &2741574062440155178
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 9 additions & 9 deletions UnityProjects/MRTKDevTemplate/Assets/Scripts/PenInteractor.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
// Copyright (c) Mixed Reality Toolkit Contributors
// Licensed under the BSD 3-Clause

// Disable "missing XML comment" warning for samples. While nice to have, this XML documentation is not required for samples.
#pragma warning disable CS1591

using System.Collections.Generic;
using UnityEngine;
using UnityEngine.XR.Interaction.Toolkit;
Expand Down Expand Up @@ -38,14 +35,14 @@ internal class PenInteractor : XRBaseInteractor, IPokeInteractor
#region IPokeInteractor Implementation

/// <inheritdoc />
public float PokeRadius => 0.001f;
float IPokeInteractor.PokeRadius => 0.001f;

// The last and current poke points, forming a
// continuous poking trajectory.
private PokePath pokeTrajectory;

/// <inheritdoc />
public PokePath PokeTrajectory => pokeTrajectory;
PokePath IPokeInteractor.PokeTrajectory => pokeTrajectory;

#endregion IPokeInteractor Implementation

Expand Down Expand Up @@ -86,9 +83,13 @@ public override void ProcessInteractor(XRInteractionUpdateOrder.UpdatePhase upda
}
}

void OnTriggerStay(Collider c)
/// <summary>
/// OnTriggerStay is called once per physics update for every Collider <paramref name="other"/> that is touching the trigger.
/// </summary>
/// <param name="other">The other Collider involved in this collision.</param>
protected void OnTriggerStay(Collider other)
{
if (interactionManager.TryGetInteractableForCollider(c, out var associatedInteractable))
if (interactionManager.TryGetInteractableForCollider(other, out IXRInteractable associatedInteractable))
{
hoveredTargets.Add(associatedInteractable);
}
Expand All @@ -97,10 +98,9 @@ void OnTriggerStay(Collider c)
/// <summary>
/// A Unity event function that is called at an framerate independent frequency, and is only called if this object is enabled.
/// </summary>
private void FixedUpdate()
protected void FixedUpdate()
{
hoveredTargets.Clear();
}
}
}
#pragma warning restore CS1591