tilted
This commit is contained in:
parent
84ec2ffdd1
commit
9a72001c17
1 changed files with 11 additions and 22 deletions
31
app/Oriel.cs
31
app/Oriel.cs
|
@ -62,6 +62,7 @@ public class Oriel {
|
||||||
Quat qOffset = Quat.Identity;
|
Quat qOffset = Quat.Identity;
|
||||||
Vec3 vOffset = Vec3.Zero;
|
Vec3 vOffset = Vec3.Zero;
|
||||||
Vec3 lOffset = Vec3.Zero;
|
Vec3 lOffset = Vec3.Zero;
|
||||||
|
Vec3 dirOrigin = Vec3.Zero;
|
||||||
Matrix mOffset = Matrix.Identity;
|
Matrix mOffset = Matrix.Identity;
|
||||||
|
|
||||||
Vec3 cornerDetect = Vec3.Zero;
|
Vec3 cornerDetect = Vec3.Zero;
|
||||||
|
@ -140,6 +141,9 @@ public class Oriel {
|
||||||
|
|
||||||
vOffset = cursor - bounds.center;
|
vOffset = cursor - bounds.center;
|
||||||
lOffset = ori.Inverse * vOffset;
|
lOffset = ori.Inverse * vOffset;
|
||||||
|
|
||||||
|
dirOrigin = (localCursor * detect.Abs()).Normalized;
|
||||||
|
|
||||||
qOffset = (ori.Inverse * cursorOri).Normalized;
|
qOffset = (ori.Inverse * cursorOri).Normalized;
|
||||||
mOffset = matrix;
|
mOffset = matrix;
|
||||||
|
|
||||||
|
@ -149,7 +153,7 @@ public class Oriel {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (interacting) {
|
if (interacting) {
|
||||||
if (detectCount == 1) { // Move (face -> crown *face)
|
if (detectCount == 1) { // Grab (face -> crown *face)
|
||||||
ori = (cursorOri * qOffset.Inverse).Normalized;
|
ori = (cursorOri * qOffset.Inverse).Normalized;
|
||||||
// gravity snapping (within 6 degrees) *horizontal
|
// gravity snapping (within 6 degrees) *horizontal
|
||||||
// always? *here **tilt = nosnap
|
// always? *here **tilt = nosnap
|
||||||
|
@ -161,27 +165,12 @@ public class Oriel {
|
||||||
|
|
||||||
interacting = held;
|
interacting = held;
|
||||||
}
|
}
|
||||||
else if (detectCount == 2) { // Rotate (edge -> edge)
|
else if (detectCount == 2) { // Tilt (edge -> edge)
|
||||||
// localPos = mOffset.Inverse.Transform(cursor);
|
// local quaternion delta
|
||||||
// Vec3 dir = new Vec3(
|
Vec3 dir = (localCursor * detect.Abs()).Normalized;
|
||||||
// detect.x == 0 ? 0 : localPos.x,
|
Quat delta = (Quat.LookDir(dir) * Quat.LookDir(dirOrigin).Inverse).Normalized;
|
||||||
// detect.y == 0 ? 0 : localPos.y,
|
|
||||||
// detect.z == 0 ? 0 : localPos.z
|
|
||||||
// );
|
|
||||||
// Vec3 up = new Vec3(
|
|
||||||
// detect.x == 0 ? 1 : 0,
|
|
||||||
// detect.y == 0 ? 1 : 0,
|
|
||||||
// detect.z == 0 ? 1 : 0
|
|
||||||
// );
|
|
||||||
|
|
||||||
// Quat q = Quat.LookAt(Vec3.Zero, dir, up);
|
ori = (ori * delta).Normalized;
|
||||||
|
|
||||||
// if (!adjusting) {
|
|
||||||
// qOffset = (q.Inverse * ori).Normalized;
|
|
||||||
// adjusting = true;
|
|
||||||
// } else {
|
|
||||||
// ori = (q * qOffset).Normalized;
|
|
||||||
// }
|
|
||||||
|
|
||||||
interacting = held;
|
interacting = held;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue