Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use pointer rotation too for scaling and rotation manipulations in bounding box #4362

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -327,8 +327,8 @@ public bool ShowRotationHandleForZ
// Current position of the grab point
private Vector3 currentGrabPoint;

// Initial origin of the current pointer
private Vector3 initialPointerPosition;
// Grab point position in pointer space. Used to calculate the current grab point from the current pointer pose.
private Vector3 grabPointInPointer;

private CardinalAxisType[] edgeAxes;
private int[] flattenedHandles;
Expand Down Expand Up @@ -515,7 +515,7 @@ private void TransformTarget()
if (currentHandleType != HandleType.None)
{
Vector3 prevGrabPoint = currentGrabPoint;
currentGrabPoint = initialGrabPoint + currentPointer.Position - initialPointerPosition;
currentGrabPoint = (currentPointer.Rotation * grabPointInPointer) + currentPointer.Position;

if (currentHandleType == HandleType.Rotation)
{
Expand Down Expand Up @@ -1471,7 +1471,7 @@ void IMixedRealityFocusHandler.OnFocusExit(FocusEventData eventData)

void IMixedRealityPointerHandler.OnPointerUp(MixedRealityPointerEventData eventData)
{
if (currentPointer != null && eventData.SourceId == currentPointer.InputSourceParent.SourceId)
if (currentPointer != null && eventData.Pointer == currentPointer)
{
DropController();

Expand Down Expand Up @@ -1511,9 +1511,9 @@ void IMixedRealityPointerHandler.OnPointerDown(MixedRealityPointerEventData even
currentPointer = eventData.Pointer;
initialGrabPoint = currentPointer.Result.Details.Point;
currentGrabPoint = initialGrabPoint;
initialPointerPosition = eventData.Pointer.Position;
initialScale = Target.transform.localScale;
initialPosition = Target.transform.position;
grabPointInPointer = Quaternion.Inverse(eventData.Pointer.Rotation) * (initialGrabPoint - currentPointer.Position);

SetHighlighted(grabbedHandleTransform);

Expand Down