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
1 change: 1 addition & 0 deletions org.mixedrealitytoolkit.spatialmanipulation/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
* Fixed tap to place `StartPlacement()` when called just after instantiation of the component. [PR #785](https://github.com/MixedRealityToolkit/MixedRealityToolkit-Unity/pull/785)
* Fix null ref in SpatialManipulationReticle when multiple interactables are hovered. [PR #873](https://github.com/MixedRealityToolkit/MixedRealityToolkit-Unity/pull/873)
* ConstantViewSize solver now retains the initial scale and aspect ratio [PR #719](https://github.com/MixedRealityToolkit/MixedRealityToolkit-Unity/pull/719)
* Fixed Follow solver frequently logging "Look Rotation Viewing Vector Is Zero" [PR #895](https://github.com/MixedRealityToolkit/MixedRealityToolkit-Unity/pull/895)

## [3.3.0] - 2024-04-30

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -462,20 +462,27 @@ private float SimplifyAngle(float angle)
/// local xz and yz planes. If these angles fall within the leashing bounds, then we don't have
/// to modify refForward. Otherwise, we apply a correction rotation to bring it within bounds.
/// </summary>
/// <returns>Whether <paramref name="refForward"/> was clamped or not.</returns>
private bool AngularClamp(Vector3 refPosition, Quaternion refRotation, Vector3 currentPosition, ref Vector3 refForward)
{
using (AngularClampPerfMarker.Auto())
{
Vector3 toTarget = currentPosition - refPosition;
float currentDistance = toTarget.magnitude;
if (currentDistance <= 0)
if (currentDistance <= Mathf.Epsilon)
{
// No need to clamp
return false;
}

toTarget.Normalize();

if (toTarget == Vector3.zero)
{
// No need to clamp
return false;
}

// Start off with a rotation towards the target. If it's within leashing bounds, we can leave it alone.
Quaternion rotation = Quaternion.LookRotation(toTarget, Vector3.up);

Expand Down