Keep the rotation as a proportion of the width
This commit is contained in:
parent
ad023ca2f6
commit
b8f7103813
1 changed files with 2 additions and 0 deletions
|
|
@ -71,6 +71,8 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
||||||
if (TurntableEnabled)
|
if (TurntableEnabled)
|
||||||
{
|
{
|
||||||
var delta = mousePosition - rotationStartPosition;
|
var delta = mousePosition - rotationStartPosition;
|
||||||
|
// scale it to device units
|
||||||
|
delta *= 300 / this.Width;
|
||||||
var zRotation = Matrix4X4.CreateFromAxisAngle(Vector3.UnitZ.Transform(world.RotationMatrix), delta.X * MathHelper.Tau / 360.0);
|
var zRotation = Matrix4X4.CreateFromAxisAngle(Vector3.UnitZ.Transform(world.RotationMatrix), delta.X * MathHelper.Tau / 360.0);
|
||||||
var screenXRotation = Matrix4X4.CreateFromAxisAngle(Vector3.UnitX, -delta.Y * MathHelper.Tau / 360.0);
|
var screenXRotation = Matrix4X4.CreateFromAxisAngle(Vector3.UnitX, -delta.Y * MathHelper.Tau / 360.0);
|
||||||
activeRotationQuaternion = new Quaternion(zRotation * screenXRotation);
|
activeRotationQuaternion = new Quaternion(zRotation * screenXRotation);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue