Skip to content
Open
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
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Mixed Reality Toolkit Contributors
// Copyright (c) Mixed Reality Toolkit Contributors
// Licensed under the BSD 3-Clause

using MixedReality.Toolkit.Input;
Expand Down Expand Up @@ -112,7 +112,7 @@ public class MoveObjectByEyeGaze : StatefulInteractable
/// Limits the Z position of the GameObject to the specified minimum and maximum.
/// </summary>
public Vector2 LocalMinMaxZ = new Vector2(float.NegativeInfinity, float.PositiveInfinity);

[Tooltip("Fired when the GameObject is dropped.")]
[SerializeField]
private UnityEvent onDrop = null;
Expand All @@ -123,7 +123,7 @@ public class MoveObjectByEyeGaze : StatefulInteractable

private bool
onlyEyeWarpOnRelease =
true; // Only warp the currently grabbed target to the current look at location once the user releases the pinch gesture.
true; // Only warp the currently grabbed target to the current look at location once the user releases the pinch gesture.

private float originalTransparency = -1f;
private bool originalUseGravity = false;
Expand Down Expand Up @@ -366,13 +366,13 @@ private bool IsLookingAwayFromTarget()
// Check whether the user is still looking within the proximity of the target
float distanceBetweenTargetAndCurrHitPos = Angle_ToCurrHitTarget(gameObject);

// **Note for potential improvement**: It would be better to make this dependent on the target's boundary
// **Note for potential improvement**: It would be better to make this dependent on the target's boundary
// instead of its center. The way it is implemented right now may cause problems for large-scale targets.
return distanceBetweenTargetAndCurrHitPos > minLookAwayDistToEnableEyeWarp;
}

/// <summary>
/// Determine whether the user is looking away from the preview.
/// Determine whether the user is looking away from the preview.
/// </summary>
private bool IsLookingAwayFromPreview()
{
Expand Down Expand Up @@ -405,7 +405,7 @@ private bool IsLookingAwayFromPreview()

/// <summary>
/// Check if the destination is plausible. For example, this means if the target is placeable
/// on horizontal surfaces then only show a preview for (more or less) horizontal surfaces.
/// on horizontal surfaces then only show a preview for (more or less) horizontal surfaces.
/// </summary>
/// <returns>True if the target can be placed on this surface.</returns>
private bool IsDestinationPlausible()
Expand Down Expand Up @@ -488,10 +488,15 @@ private void DragAndDrop_Start()
if (TryGetComponent<Rigidbody>(out var rigidbody))
{
originalUseGravity = rigidbody.useGravity;
originalDrag = rigidbody.drag;

rigidbody.useGravity = false;

#if UNITY_6000_0_OR_NEWER
originalDrag = rigidbody.linearDamping;
rigidbody.linearDamping = float.PositiveInfinity;
#else
originalDrag = rigidbody.drag;
rigidbody.drag = float.PositiveInfinity;
#endif
}
}
}
Expand Down Expand Up @@ -520,7 +525,11 @@ private void DragAndDrop_Finish()
if (TryGetComponent<Rigidbody>(out var rigidbody))
{
rigidbody.useGravity = originalUseGravity;
#if UNITY_6000_0_OR_NEWER
rigidbody.linearDamping = originalDrag;
#else
rigidbody.drag = originalDrag;
#endif
}

onDrop.Invoke();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Mixed Reality Toolkit Contributors
// 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.
Expand Down Expand Up @@ -49,7 +49,11 @@ private void LateUpdate()
// Reset any velocity from falling or moving when re-spawning to original location
if (rigidBody != null)
{
#if UNITY_6000_0_OR_NEWER
rigidBody.linearVelocity = Vector3.zero;
#else
rigidBody.velocity = Vector3.zero;
#endif
rigidBody.angularVelocity = Vector3.zero;
}

Expand Down
1 change: 1 addition & 0 deletions org.mixedrealitytoolkit.core/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).

* Fixed "The type `MixedReality.Toolkit.Core MixedReality.Toolkit.Experimental.BubbleChildHoverEvents/TrickleChildHoverEvents/BubbleChildSelectEvents/TrickleChildSelectEvents` is being serialized by `[SerializeReference]`, but is missing the `[Serializable]` attribute." on Unity 6.3. [PR #1107](https://github.com/MixedRealityToolkit/MixedRealityToolkit-Unity/pull/1107)
* Fixed object identity API usages and obsolete sorting warnings for Unity 6.4 and newer in `FindObjectUtility`. [PR #1136](https://github.com/MixedRealityToolkit/MixedRealityToolkit-Unity/pull/1136)
* Fixed incomplete serialization hierarchy warnings (UAC1002) in Unity 6 for `InteractableEventRoute`, `InteractableParentEventRoute`, and `InteractableChildrenEventRoute` in `InteractableEventRouter`. [PR #1137](https://github.com/MixedRealityToolkit/MixedRealityToolkit-Unity/pull/1137)

## Deprecated

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Mixed Reality Toolkit Contributors
// Copyright (c) Mixed Reality Toolkit Contributors
// Licensed under the BSD 3-Clause

using System;
Expand Down Expand Up @@ -496,6 +496,7 @@ public interface IXRSelectInteractableChild : IXRInteractableEventRouteTarget
/// For these types of features, we want the community to see them and get
/// value out of them early enough so to provide feedback.
/// </remarks>
[Serializable]
public abstract class InteractableEventRoute<S, T> : IXRInteractableEventRoute
where S : IXRInteractable
where T : IXRInteractableEventRouteTarget
Expand Down Expand Up @@ -630,6 +631,7 @@ private void FilterTargets(GameObject origin, List<T> targets)
/// For these types of features, we want the community to see them and get
/// value out of them early enough so to provide feedback.
/// </remarks>
[Serializable]
public abstract class InteractableParentEventRoute<S, T> : InteractableEventRoute<S, T>
where S : IXRInteractable
where T : IXRInteractableEventRouteTarget
Expand Down Expand Up @@ -668,6 +670,7 @@ protected override void GetTargets(GameObject origin, List<T> targets)
/// For these types of features, we want the community to see them and get
/// value out of them early enough so to provide feedback.
/// </remarks>
[Serializable]
public abstract class InteractableChildrenEventRoute<S, T> : InteractableEventRoute<S, T>
where S : IXRInteractable
where T : IXRInteractableEventRouteTarget
Expand Down
1 change: 1 addition & 0 deletions org.mixedrealitytoolkit.input/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
* Fixed "leaked managed shell" issue in `InteractionModeManager`. [PR #1096](https://github.com/MixedRealityToolkit/MixedRealityToolkit-Unity/pull/1096)
* Fixed `EyeCalibrationChecker` build issue on UWP when the Mixed Reality OpenXR Plugin wasn't installed. [PR #1106](https://github.com/MixedRealityToolkit/MixedRealityToolkit-Unity/pull/1106)
* Fixed object identity API usages for Unity 6.4 and newer in `InteractionModeManagerEditor`. [PR #1136](https://github.com/MixedRealityToolkit/MixedRealityToolkit-Unity/pull/1136)
* Fixed incomplete serialization hierarchy warning (UAC1002) in Unity 6 by adding `[Serializable]` to `HandBasedPoseSource`. [PR #1137](https://github.com/MixedRealityToolkit/MixedRealityToolkit-Unity/pull/1137)

## [3.3.0] - 2025-11-12

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ namespace MixedReality.Toolkit.Input
/// <summary>
/// Helps define a pose source that's based on a specific handedness with access to the current <see cref="HandsAggregatorSubsystem"/>.
/// </summary>
[Serializable]
public abstract class HandBasedPoseSource : IPoseSource
{
/// <summary>
Expand Down
1 change: 1 addition & 0 deletions org.mixedrealitytoolkit.spatialmanipulation/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).

* Fixed "leaked managed shell" issue in `BoundsCalculator`. [PR #1096](https://github.com/MixedRealityToolkit/MixedRealityToolkit-Unity/pull/1096)
* Fixed object identity API usages for Unity 6.4 and newer in `ConstraintManagerEditor`. [PR #1136](https://github.com/MixedRealityToolkit/MixedRealityToolkit-Unity/pull/1136)
* Fixed obsolete physics property warnings on Unity 6 and newer in `ObjectManipulator`. [PR #1137](https://github.com/MixedRealityToolkit/MixedRealityToolkit-Unity/pull/1137)

### Changed

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -760,7 +760,11 @@ protected override void OnSelectExited(SelectExitEventArgs args)
{
if (interactorsSelecting.Count == 0)
{
#if UNITY_6000_0_OR_NEWER
ReleaseRigidBody(rigidBody.linearVelocity, rigidBody.angularVelocity);
#else
ReleaseRigidBody(rigidBody.velocity, rigidBody.angularVelocity);
#endif
}
else
{
Expand Down Expand Up @@ -908,7 +912,11 @@ private void ApplyForcesToRigidbody()
// when player is moving, we need to anticipate where the targetTransform is going to be one time step from now
distance -= referenceFrameVelocity * Time.fixedDeltaTime;

#if UNITY_6000_0_OR_NEWER
var velocity = rigidBody.linearVelocity;
#else
var velocity = rigidBody.velocity;
#endif

var acceleration = omega * omega * -distance; // acceleration caused by spring force

Expand Down Expand Up @@ -937,7 +945,11 @@ private void ApplyForcesToRigidbody()

velocity += referenceFrameVelocity; // change back to global frame of reference

#if UNITY_6000_0_OR_NEWER
rigidBody.linearVelocity = velocity;
#else
rigidBody.velocity = velocity;
#endif

if (applyTorque)
{
Expand Down Expand Up @@ -1035,7 +1047,11 @@ private void ReleaseRigidBody(Vector3 velocity, Vector3 angularVelocity)
{
if (releaseBehavior.IsMaskSet(ReleaseBehaviorType.KeepVelocity))
{
#if UNITY_6000_0_OR_NEWER
rigidBody.linearVelocity = velocity;
#else
rigidBody.velocity = velocity;
#endif
}

if (releaseBehavior.IsMaskSet(ReleaseBehaviorType.KeepAngularVelocity))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -987,7 +987,11 @@ public IEnumerator ObjectManipulatorRigidbodyCollision()
yield return hand.Move(Vector3.forward * 3f);
yield return RuntimeTestUtilities.WaitForFixedUpdates();

#if UNITY_6000_0_OR_NEWER
Assert.AreNotEqual(Vector3.zero, backgroundRigidbody.linearVelocity);
#else
Assert.AreNotEqual(Vector3.zero, backgroundRigidbody.velocity);
#endif
Assert.AreEqual(1, collisionListener.CollisionCount);
}

Expand Down Expand Up @@ -1228,7 +1232,11 @@ public IEnumerator ObjectManipulatorNearThrow()
// With simulated hand angular velocity would not be equal to 0, because of how simulation
// moves hand when releasing the Pitch. Even though it doesn't directly follow from hand movement, there will always be some rotation.
// Assert.NotZero(rigidBody.angularVelocity.magnitude, "ObjectManipulator should apply angular velocity to rigidBody upon release.");
#if UNITY_6000_0_OR_NEWER
Assert.AreEqual(hand.GetVelocity(), rigidBody.linearVelocity, "ObjectManipulator should apply hand velocity to rigidBody upon release.");
#else
Assert.AreEqual(hand.GetVelocity(), rigidBody.velocity, "ObjectManipulator should apply hand velocity to rigidBody upon release.");
#endif

// This is just for debugging purposes, so object's movement after release can be seen.
yield return hand.MoveTo(initialHandPosition);
Expand Down
Loading