diff --git a/add/thumb_pad.glb b/add/thumb_pad.glb index 8b3efb3..181bbc3 100644 Binary files a/add/thumb_pad.glb and b/add/thumb_pad.glb differ diff --git a/app/Mono.cs b/app/Mono.cs index b184d7c..0986046 100644 --- a/app/Mono.cs +++ b/app/Mono.cs @@ -69,13 +69,14 @@ public class Mono { matHolo.DepthWrite = false; matHolo.DepthTest = DepthTest.Always; matHolo.FaceCull = Cull.None; - matHolo.SetTexture("diffuse", Tex.DevTex); + // matHolo.SetTexture("diffuse", Tex.DevTex); + matHolo.Wireframe = true; } public void Frame() { // Input.HandClearOverride(Handed.Left); - Input.HandClearOverride(Handed.Right); + // Input.HandClearOverride(Handed.Right); // store hand pre override in rig rig.Step(); @@ -108,24 +109,6 @@ public class Mono { lwc.Demo(ltb.ori); rwc.Demo(rtb.ori); - Mesh.Cube.Draw(Mono.inst.matHolo, - Matrix.TRS( - lwc.cursor.position, - Quat.Identity, // ltb.ori, - 0.015f - ), - new Color(0, 1, 1) - ); - - Mesh.Cube.Draw(Mono.inst.matHolo, - Matrix.TRS( - rwc.cursor.position, - Quat.Identity, // rtb.ori, - 0.015f - ), - new Color(0, 1, 1) - ); - // rBlock.Step(); lBlock.Step(); // cubicCon.Step(); @@ -175,7 +158,7 @@ public class Mono { UI.WindowEnd(); } public float trailLen = 0.666f; - public float trailScl = 0.2f; + public float trailScl = 0.333f; public float stretchStr = 0.5f; public float playerY = 0; diff --git a/app/dofs/stretch-cursor/wave/WaveCursor.cs b/app/dofs/stretch-cursor/wave/WaveCursor.cs index 1befdd8..1729dfd 100644 --- a/app/dofs/stretch-cursor/wave/WaveCursor.cs +++ b/app/dofs/stretch-cursor/wave/WaveCursor.cs @@ -2,8 +2,15 @@ namespace Oriels; class WaveCursor : dof { + public class Cursor + { + public Vec3 raw; + public Vec3 pos; + public Vec3 smooth; + } + // data - public Pose cursor = Pose.Identity; + public Cursor cursor = new Cursor(); PullRequest.OneEuroFilter xF = new PullRequest.OneEuroFilter(0.001f, 0.1f); PullRequest.OneEuroFilter yF = new PullRequest.OneEuroFilter(0.001f, 0.1f); PullRequest.OneEuroFilter zF = new PullRequest.OneEuroFilter(0.001f, 0.1f); @@ -24,16 +31,16 @@ class WaveCursor : dof { hand.Get(FingerId.Index, JointId.Tip).position, hand.Get(FingerId.Index, JointId.KnuckleMajor).position ); + + cursor.raw = hand.Get(FingerId.Index, JointId.Tip).position + dir * stretch * strength * Mono.inst.stretchStr; + cursor.pos.x = (float)xF.Filter(cursor.raw.x, (double)Time.Elapsedf); + cursor.pos.y = (float)yF.Filter(cursor.raw.y, (double)Time.Elapsedf); + cursor.pos.z = (float)zF.Filter(cursor.raw.z, (double)Time.Elapsedf); + cursor.smooth = Vec3.Lerp(cursor.smooth, cursor.pos, Time.Elapsedf * 6f); - Vec3 rawPos = hand.Get(FingerId.Index, JointId.Tip).position + dir * stretch * strength * Mono.inst.stretchStr; - Mesh.Cube.Draw(Mono.inst.matHolo, Matrix.TRS(rawPos, Quat.Identity, 0.01f), new Color(1, 0, 0)); - - rawPos.x = (float)xF.Filter(rawPos.x, (double)Time.Elapsedf); - rawPos.y = (float)yF.Filter(rawPos.y, (double)Time.Elapsedf); - rawPos.z = (float)zF.Filter(rawPos.z, (double)Time.Elapsedf); - cursor.position = rawPos; // Vec3.Lerp(cursor.position, rawPos, Time.Elapsedf * 6f); - - cursor.orientation = hand.palm.orientation; + Mesh.Sphere.Draw(Mono.inst.matHolo, Matrix.TRS(cursor.raw, Quat.Identity, 0.01f), new Color(1, 0, 0)); + Mesh.Sphere.Draw(Mono.inst.matHolo, Matrix.TRS(cursor.pos, Quat.Identity, 0.01f), new Color(0, 1, 0)); + Mesh.Sphere.Draw(Mono.inst.matHolo, Matrix.TRS(cursor.smooth, Quat.Identity, 0.01f), new Color(0, 0, 1)); } } @@ -58,16 +65,16 @@ class WaveCursor : dof { } - Vec3[] mm = new Vec3[64]; + Vec3[] mm = new Vec3[81]; - Vec3[] xL = new Vec3[64]; - Vec3[] xR = new Vec3[64]; - Vec3[] yL = new Vec3[64]; - Vec3[] yR = new Vec3[64]; - Vec3[] zL = new Vec3[64]; - Vec3[] zR = new Vec3[64]; + Vec3[] xL = new Vec3[81]; + Vec3[] xR = new Vec3[81]; + Vec3[] yL = new Vec3[81]; + Vec3[] yR = new Vec3[81]; + Vec3[] zL = new Vec3[81]; + Vec3[] zR = new Vec3[81]; public void Demo(Quat ori) { - Trail(mm, cursor.position); // + ori * new Vec3(0, 0, 0.04f)); + Trail(mm, cursor.smooth + ori * new Vec3(0, 0, 0.08f)); // Trail(xL, smoothPos + cursor.orientation * new Vec3(-1, 0, 0) * 0.1f); // Trail(xR, smoothPos + cursor.orientation * new Vec3( 1, 0, 0) * 0.1f); @@ -78,19 +85,27 @@ class WaveCursor : dof { } void Trail(Vec3[] points, Vec3 nextPos) { - points[0] = nextPos; + while (Vec3.Distance(points[0], nextPos) > 0.03f * Mono.inst.trailScl) { + for (int i = points.Length - 1; i > 0; i--) { + points[i] = points[i - 1]; + } + points[0] += Vec3.Direction(nextPos, points[0]) * 0.02f * Mono.inst.trailScl; + } + + + // points[0] = nextPos; int len = (int)(points.Length * Mono.inst.trailLen); for (int i = 0; i < len; i++) { - if (i > 0) { - Vec3 dir = Vec3.Forward; - if (points[i].v != points[i - 1].v) { - dir = PullRequest.Direction(points[i], points[i - 1]); - } - points[i] = points[i - 1] + dir * 0.02f * Mono.inst.trailScl; - } + // if (i > 0) { + // Vec3 dir = Vec3.Forward; + // if (points[i].v != points[i - 1].v) { + // dir = PullRequest.Direction(points[i], points[i - 1]); + // } + // // points[i] = points[i - 1] + dir * 0.02f * Mono.inst.trailScl; + // } Vec3 from = i > 0 ? points[i - 1] : nextPos; - Quat ori = Quat.LookDir(PullRequest.Direction(points[i], from)); + Quat ori = Quat.LookDir(Vec3.Direction(points[i], from)); Mesh.Cube.Draw( Mono.inst.matHolo, Matrix.TRS( diff --git a/app/dofs/trackballer/Trackballer.cs b/app/dofs/trackballer/Trackballer.cs index 2bc2827..fc6133a 100644 --- a/app/dofs/trackballer/Trackballer.cs +++ b/app/dofs/trackballer/Trackballer.cs @@ -39,7 +39,7 @@ class Trackballer : dof { thumbRot, new Vec3(handed == Handed.Left ? -1f : 1f, 1f, 1f) * 0.1666f ); - mesh.Draw(Mono.inst.matHolo, mMesh, new Color(0, 0, 1)); + mesh.Draw(Mono.inst.matHolo, mMesh, new Color(0, 1, 1)); // closest to anchor float closest = 100000f; @@ -84,7 +84,7 @@ class Trackballer : dof { // Lines.Add(thumbTip, thumbKnuckle, Color.White, 0.002f); - Mesh.Sphere.Draw(Mono.inst.matHolo, Matrix.TRS(mAnchor.Transform(localPad), hand.palm.orientation, 0.004f), new Color(0, 1, 0)); + Mesh.Sphere.Draw(Mono.inst.matHolo, Matrix.TRS(mAnchor.Transform(localPad), hand.palm.orientation, 0.002f), new Color(0, 1, 1)); // if (btnIn.held) { @@ -118,8 +118,8 @@ class Trackballer : dof { } // Draw - Mesh.Sphere.Draw(Mono.inst.matHolo, Matrix.TRS(anchor, ori, 0.04f), new Color(inT, 0, 0)); - Mesh.Cube.Draw(Mono.inst.matHolo, Matrix.TRS(anchor, ori, 0.04f), new Color(0, outT * 0.2f, 0)); + Mesh.Sphere.Draw(Mono.inst.matHolo, Matrix.TRS(anchor, ori, layer[1] * 2), new Color(inT, 0, 0)); + // Mesh.Cube.Draw(Mono.inst.matHolo, Matrix.TRS(anchor, ori, 0.04f), new Color(0, outT * 0.2f, 0)); } Quat newOri = momentum * ori; @@ -139,14 +139,12 @@ class Trackballer : dof { COMMENTS distinct interactions to account for (relative to palm orientation) - w/rating assuming perfect tracking - y swipe (10/10) - z swipe (05/10) - x spin (02/10) + y swipe + z swipe + x spin how reliable is the provided palm orientation? - show when you are about to boolean + more boolean visual and audio feeback - 2d pad? */ \ No newline at end of file diff --git a/res/thumb_pad.blend b/res/thumb_pad.blend index 90f10dc..6c2af65 100644 Binary files a/res/thumb_pad.blend and b/res/thumb_pad.blend differ