private void OffsetTargetsFromAnchor() { IInputDevice inputDevice = RTInputDevice.Get.Device; if (!inputDevice.WasMoved()) { return; } float scaleFactor = 1.0f + inputDevice.GetCaptureDelta(_deltaCaptureId).x *SharedSettings.OffsetFromAnchorSensitivity; foreach (GrabTarget grabTarget in _grabTargets) { if (grabTarget == null) { continue; } grabTarget.Transform.position = (_grabSurfaceInfo.AnchorPoint + grabTarget.AnchorVectorSnapshot * scaleFactor); } CalculateGrabTargetsAnchorVectors(); SnapTargetsToSurface(); }
private void ScaleTargets() { IInputDevice inputDevice = RTInputDevice.Get.Device; if (!inputDevice.WasMoved()) { return; } foreach (GrabTarget grabTarget in _grabTargets) { if (grabTarget == null) { continue; } float scaleFactor = 1.0f + inputDevice.GetCaptureDelta(_deltaCaptureId).x *SharedSettings.ScaleSensitivity; Vector3 newScale = grabTarget.WorldScaleSnapshot * scaleFactor; grabTarget.GameObject.SetHierarchyWorldScaleByPivot(newScale, grabTarget.SittingPoint + grabTarget.SittingPlane.normal * grabTarget.OffsetFromSurface); } CalculateGrabTargetsAnchorVectors(); }