Skip to content

Commit

Permalink
Add new UxrGrabbableObject constraints system, improve manipulation a…
Browse files Browse the repository at this point in the history
…nd general bugfixes.
  • Loading branch information
entromp committed Oct 13, 2022
1 parent a97a702 commit 69c849e
Show file tree
Hide file tree
Showing 83 changed files with 4,283 additions and 1,719 deletions.
60 changes: 59 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,63 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [0.9.0] - 2022-10-13

### Added

- Add new UxrGrabbableObject constraints functionality with improved manipulation.
- Add UxrGrabbableObject gizmos to visualize rotation/translation constraints.
- Add new UxrGrabbableObject rotation/translation constraint modes.
- Add support to UxrGrabbableObject for rotation constraints on all 3 axes.
- Add support to UxrGrabbableObject for a single rotation constraint over 360 degrees.
- Improve manipulation behavior when grabbing objects to detect the grip and know which part
of the hand creates more leverage.
- Add possibility to parent to destination in locomotion components: UxrTeleportLocomotion and
UxrSmoothLocomotion.
- Add new teleport methods to UxrManager to teleport relative to moving objects.
- Add new functionality to GameObjectExt to compute bounds recursively.
- Add new functionality to MeshExt to compute skinned mesh vertices and bone influences.
- Add new misc functionality to FloatExt, IntExt, Vector3Ext, Vector3IntExt and TransformExt.
- Add new data to UxrAvatarRigInfo.
- Add versioning to avatar rig info serialization and automatic updating.
- Add IUxrLogger interface to unify logging in managers.
- Add logging to UxrWeaponManager.
- Add new properties to UxrComponent with initial Transform data.
- Add new UxrAxis properties and functionality.
- Add possibility to access avatar grabbers at edit-time.

### Changed

- Improve all UxrGrabbableObject and hand grab/release/constrain transitions.
- Move UxrGrabbableObject constraints to the top of the inspector.
- Replace GrabAndMove/RotateAroundAxis manipulation modes by new constraint system.
- Change UxrGrabbableObject rotation and translation constraints reference.
Rotations are performed around the grabbable object local axes.
Translations are performed along the initial grabbable object local axes.
- Improve UxrAvatarRig reference solving.

### Removed

- Remove parent reference to UxrGrabbableObject rotation/translation constraints.
- Remove UxrManipulationMode. New constraint system and UxrRotationProvider is used instead.

### Fixed

- Fix manipulation not working correctly on moving platforms.
- Fix incorrect manipulation release on objects with non-default grab button(s).
- Fix UxrGrabbableObject release multipliers not working correctly with values less than 1.
- Fix UxrGrabbableObject Constrain events not being called in some cases.
- Fix UxrAvatarEditor throwing exception when using Fix button to save prefab variant.
- Fix UxrCameraWallFade throwing exception when there are no avatars.
- Fix constrained rotations not being able to go over 180 degrees.
- Fix pre-caching triggered by non-local avatars. Only local avatar triggers pre-caching now.
- Fix locomotion components detecting avatar or grabbed objects as obstacles.
- Fix locomotion not working correctly on moving platforms.
- Fix UxrWeaponManager not tracking actors correctly.
- Fix UxrMagnifyingGlassUrp error when not using URP.
- Fix CyborgAvatar_URP base to use index controllers correctly.
- Fix some CyborgAvatar_BRP base materials that were using the URP variants.

## [0.8.4] - 2022-08-05

### Added
Expand Down Expand Up @@ -71,7 +128,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- First public release!

[Unreleased]: https://github.com/VRMADA/ultimatexr-unity/compare/v0.8.4...HEAD
[Unreleased]: https://github.com/VRMADA/ultimatexr-unity/compare/v0.9.0...HEAD
[0.9.0]: https://github.com/VRMADA/ultimatexr-unity/releases/tag/v0.9.0
[0.8.4]: https://github.com/VRMADA/ultimatexr-unity/releases/tag/v0.8.4
[0.8.3]: https://github.com/VRMADA/ultimatexr-unity/releases/tag/v0.8.3
[0.8.2]: https://github.com/VRMADA/ultimatexr-unity/releases/tag/v0.8.2
Expand Down
35 changes: 16 additions & 19 deletions Examples/FullScene/Prefabs/Lab/Battery.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -654,7 +654,6 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: f9d66e1c4a827a345a4c670b5cbf2d14, type: 3}
m_Name:
m_EditorClassIdentifier:
_grabbableObject: {fileID: 4029760754406280085}
_batteryDiameter: 0.2
_batteryInsertOffset: 0.34
--- !u!114 &4029760754406280085
Expand All @@ -669,16 +668,29 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 79f5a30897a3c024c805c866226dd743, type: 3}
m_Name:
m_EditorClassIdentifier:
_manipulationMode: 0
_controlParentDirection: 0
_ignoreGrabbableParentDependency: 1
_priority: 0
_allowMultiGrab: 0
_translationConstraintMode: 2
_restrictToBox: {fileID: 0}
_restrictToSphere: {fileID: 0}
_translationLimitsMin: {x: 0, y: 0, z: 0}
_translationLimitsMax: {x: 0, y: 0, z: 0.35}
_rotationConstraintMode: 2
_rotationAngleLimitsMin: {x: 0, y: 0, z: 0}
_rotationAngleLimitsMax: {x: 0, y: 0, z: 0}
_rotationProvider: 0
_rotationLongitudinalAxis:
_axis: 2
_needsTwoHandsToRotate: 0
_lockedGrabReleaseDistance: 0.4
_translationResistance: 0.07
_rotationResistance: 0.07
_rigidBodySource: {fileID: 2295813357377736856}
_rigidBodyDynamicOnRelease: 1
_verticalReleaseMultiplier: 1
_horizontalReleaseMultiplier: 1
_needsTwoHandsToRotate: 0
_allowMultiGrab: 0
_previewGrabPosesMode: 3
_previewPosesRegenerationType: 0
_previewPosesRegenerationIndex: -1
Expand Down Expand Up @@ -792,21 +804,6 @@ MonoBehaviour:
_dropSnapMode: 0
_dropProximityTransformUseSelf: 1
_dropProximityTransform: {fileID: 0}
_translationConstraintMode: 2
_restrictToBox: {fileID: 0}
_restrictToSphere: {fileID: 0}
_translationLimitsMin: {x: 0, y: 0, z: 0}
_translationLimitsMax: {x: 0, y: 0, z: 0.35}
_translationLimitsReferenceIsParent: 1
_translationLimitsParent: {fileID: 0}
_rotationConstraintMode: 1
_rotationAngleLimitsMin: {x: 0, y: 0, z: 0}
_rotationAngleLimitsMax: {x: 0, y: 0, z: 0}
_rotationLimitsReferenceIsParent: 1
_rotationLimitsParent: {fileID: 0}
_lockedGrabReleaseDistance: 0.4
_translationResistance: 0.07
_rotationResistance: 0.07
--- !u!114 &2781093687404522855
MonoBehaviour:
m_ObjectHideFlags: 0
Expand Down
70 changes: 33 additions & 37 deletions Examples/FullScene/Prefabs/Lab/Generator.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -1680,16 +1680,29 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 79f5a30897a3c024c805c866226dd743, type: 3}
m_Name:
m_EditorClassIdentifier:
_manipulationMode: 1
_controlParentDirection: 1
_ignoreGrabbableParentDependency: 0
_priority: 0
_allowMultiGrab: 0
_translationConstraintMode: 4
_restrictToBox: {fileID: 0}
_restrictToSphere: {fileID: 0}
_translationLimitsMin: {x: 0, y: 0, z: 0}
_translationLimitsMax: {x: 0, y: 0, z: 0}
_rotationConstraintMode: 1
_rotationAngleLimitsMin: {x: 0, y: 0, z: 0}
_rotationAngleLimitsMax: {x: 0, y: 45, z: 0}
_rotationProvider: 1
_rotationLongitudinalAxis:
_axis: 2
_needsTwoHandsToRotate: 0
_lockedGrabReleaseDistance: 0.4
_translationResistance: 0
_rotationResistance: 0
_rigidBodySource: {fileID: 0}
_rigidBodyDynamicOnRelease: 1
_verticalReleaseMultiplier: 1
_horizontalReleaseMultiplier: 1
_needsTwoHandsToRotate: 0
_allowMultiGrab: 0
_previewGrabPosesMode: 3
_previewPosesRegenerationType: 0
_previewPosesRegenerationIndex: -1
Expand Down Expand Up @@ -1750,21 +1763,6 @@ MonoBehaviour:
_dropSnapMode: 0
_dropProximityTransformUseSelf: 1
_dropProximityTransform: {fileID: 0}
_translationConstraintMode: 0
_restrictToBox: {fileID: 0}
_restrictToSphere: {fileID: 0}
_translationLimitsMin: {x: 0, y: 0, z: 0}
_translationLimitsMax: {x: 0, y: 0, z: 0}
_translationLimitsReferenceIsParent: 1
_translationLimitsParent: {fileID: 0}
_rotationConstraintMode: 0
_rotationAngleLimitsMin: {x: 0, y: 0, z: 0}
_rotationAngleLimitsMax: {x: 0, y: 45, z: 0}
_rotationLimitsReferenceIsParent: 1
_rotationLimitsParent: {fileID: 0}
_lockedGrabReleaseDistance: 0.4
_translationResistance: 0
_rotationResistance: 0
--- !u!114 &7499747384943950240
MonoBehaviour:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -1858,16 +1856,29 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 79f5a30897a3c024c805c866226dd743, type: 3}
m_Name:
m_EditorClassIdentifier:
_manipulationMode: 1
_controlParentDirection: 1
_controlParentDirection: 0
_ignoreGrabbableParentDependency: 0
_priority: 0
_allowMultiGrab: 1
_translationConstraintMode: 4
_restrictToBox: {fileID: 0}
_restrictToSphere: {fileID: 0}
_translationLimitsMin: {x: 0, y: 0, z: 0}
_translationLimitsMax: {x: 0, y: 0, z: 0}
_rotationConstraintMode: 1
_rotationAngleLimitsMin: {x: 0, y: 0, z: 0}
_rotationAngleLimitsMax: {x: 0, y: 0, z: 45}
_rotationProvider: 1
_rotationLongitudinalAxis:
_axis: 2
_needsTwoHandsToRotate: 1
_lockedGrabReleaseDistance: 0.4
_translationResistance: 0
_rotationResistance: 0
_rigidBodySource: {fileID: 0}
_rigidBodyDynamicOnRelease: 1
_verticalReleaseMultiplier: 1
_horizontalReleaseMultiplier: 1
_needsTwoHandsToRotate: 1
_allowMultiGrab: 1
_previewGrabPosesMode: 3
_previewPosesRegenerationType: 0
_previewPosesRegenerationIndex: -1
Expand Down Expand Up @@ -1971,21 +1982,6 @@ MonoBehaviour:
_dropSnapMode: 0
_dropProximityTransformUseSelf: 1
_dropProximityTransform: {fileID: 0}
_translationConstraintMode: 0
_restrictToBox: {fileID: 0}
_restrictToSphere: {fileID: 0}
_translationLimitsMin: {x: 0, y: 0, z: 0}
_translationLimitsMax: {x: 0, y: 0, z: 0}
_translationLimitsReferenceIsParent: 1
_translationLimitsParent: {fileID: 0}
_rotationConstraintMode: 0
_rotationAngleLimitsMin: {x: 0, y: 0, z: 0}
_rotationAngleLimitsMax: {x: 0, y: 0, z: 45}
_rotationLimitsReferenceIsParent: 1
_rotationLimitsParent: {fileID: 0}
_lockedGrabReleaseDistance: 0.4
_translationResistance: 0
_rotationResistance: 0
--- !u!114 &5205576574750625359
MonoBehaviour:
m_ObjectHideFlags: 0
Expand Down
2 changes: 1 addition & 1 deletion Examples/FullScene/Scripts/GlobalLogic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ private void UxrManager_AvatarMoved(object sender, UxrAvatarMoveEventArgs e)
/// </summary>
private void UxrManager_AvatarsUpdated()
{
if (UxrCameraWallFade.IsAvatarPeekingThroughGeometry(UxrAvatar.LocalAvatar))
if (UxrAvatar.LocalAvatar == null || UxrCameraWallFade.IsAvatarPeekingThroughGeometry(UxrAvatar.LocalAvatar))
{
return;
}
Expand Down
2 changes: 1 addition & 1 deletion Examples/FullScene/Scripts/Lab/Battery.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ private void UxrManager_AvatarsUpdated()
// Add constraints and place

GrabbableObject.TranslationConstraint = UxrTranslationConstraintMode.RestrictLocalOffset;
GrabbableObject.RotationConstraint = UxrRotationConstraintMode.RestrictLocalRotation;
GrabbableObject.RotationConstraint = UxrRotationConstraintMode.Locked;

UxrGrabManager.Instance.PlaceObject(GrabbableObject, batteryAnchor.Anchor, UxrPlacementType.Smooth, false);

Expand Down
14 changes: 4 additions & 10 deletions Examples/FullScene/Scripts/Lab/GeneratorDoor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ public bool IsLockOpen
get => LockHandleOpenValue > 0.5f;
private set
{
_grabbableLock.transform.localRotation = _grabbableLock.InitialLocalRotation * Quaternion.AngleAxis(value ? _lockHandleAngleOpen : _lockHandleAngleClosed, Vector3.forward);
// Set rotation using the correct property to avoid interference between grabbable object constraint calculation and manually setting its transform.
_grabbableLock.SingleRotationAxisDegrees = value ? _lockHandleAngleOpen : _lockHandleAngleClosed;

for (int i = 0; i < _locks.Length; ++i)
{
Expand Down Expand Up @@ -69,9 +70,6 @@ protected override void Awake()
_lockInitialRotation[i] = _locks[i].localRotation;
}

_lockHandleAngleConstraintMin = _grabbableLock.RotationAngleLimitsMin;
_lockHandleAngleConstraintMax = _grabbableLock.RotationAngleLimitsMax;

IsBatteryInContact = _batteryAnchor.Anchor.CurrentPlacedObject != null;
}

Expand Down Expand Up @@ -150,13 +148,11 @@ private void Lock_ConstraintsApplied(object sender, UxrApplyConstraintsEventArgs

if (_batteryAnchor.Anchor.CurrentPlacedObject != null && _batteryAnchor.Anchor.CurrentPlacedObject.transform.localPosition.z > 0.01f)
{
_grabbableLock.RotationAngleLimitsMin = _grabbableLock.transform.localRotation.eulerAngles;
_grabbableLock.RotationAngleLimitsMax = _grabbableLock.transform.localRotation.eulerAngles;
_grabbableLock.RotationConstraint = UxrRotationConstraintMode.Locked;
}
else
{
_grabbableLock.RotationAngleLimitsMin = _lockHandleAngleConstraintMin;
_grabbableLock.RotationAngleLimitsMax = _lockHandleAngleConstraintMax;
_grabbableLock.RotationConstraint = UxrRotationConstraintMode.RestrictLocalRotation;
}
}

Expand Down Expand Up @@ -198,8 +194,6 @@ private float LockHandleOpenValue

private bool _isBatteryInContact;
private Quaternion[] _lockInitialRotation;
private Vector3 _lockHandleAngleConstraintMin;
private Vector3 _lockHandleAngleConstraintMax;

#endregion
}
Expand Down
Loading

0 comments on commit 69c849e

Please sign in to comment.