trackballer demo pre polish
This commit is contained in:
parent
ffd8fbb3d8
commit
95b1bd3918
5 changed files with 54 additions and 58 deletions
Binary file not shown.
25
app/Mono.cs
25
app/Mono.cs
|
@ -69,13 +69,14 @@ public class Mono {
|
||||||
matHolo.DepthWrite = false;
|
matHolo.DepthWrite = false;
|
||||||
matHolo.DepthTest = DepthTest.Always;
|
matHolo.DepthTest = DepthTest.Always;
|
||||||
matHolo.FaceCull = Cull.None;
|
matHolo.FaceCull = Cull.None;
|
||||||
matHolo.SetTexture("diffuse", Tex.DevTex);
|
// matHolo.SetTexture("diffuse", Tex.DevTex);
|
||||||
|
matHolo.Wireframe = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Frame() {
|
public void Frame() {
|
||||||
|
|
||||||
// Input.HandClearOverride(Handed.Left);
|
// Input.HandClearOverride(Handed.Left);
|
||||||
Input.HandClearOverride(Handed.Right);
|
// Input.HandClearOverride(Handed.Right);
|
||||||
// store hand pre override in rig
|
// store hand pre override in rig
|
||||||
rig.Step();
|
rig.Step();
|
||||||
|
|
||||||
|
@ -108,24 +109,6 @@ public class Mono {
|
||||||
lwc.Demo(ltb.ori);
|
lwc.Demo(ltb.ori);
|
||||||
rwc.Demo(rtb.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();
|
// rBlock.Step(); lBlock.Step();
|
||||||
|
|
||||||
// cubicCon.Step();
|
// cubicCon.Step();
|
||||||
|
@ -175,7 +158,7 @@ public class Mono {
|
||||||
UI.WindowEnd();
|
UI.WindowEnd();
|
||||||
}
|
}
|
||||||
public float trailLen = 0.666f;
|
public float trailLen = 0.666f;
|
||||||
public float trailScl = 0.2f;
|
public float trailScl = 0.333f;
|
||||||
public float stretchStr = 0.5f;
|
public float stretchStr = 0.5f;
|
||||||
public float playerY = 0;
|
public float playerY = 0;
|
||||||
|
|
||||||
|
|
|
@ -2,8 +2,15 @@ namespace Oriels;
|
||||||
|
|
||||||
class WaveCursor : dof {
|
class WaveCursor : dof {
|
||||||
|
|
||||||
|
public class Cursor
|
||||||
|
{
|
||||||
|
public Vec3 raw;
|
||||||
|
public Vec3 pos;
|
||||||
|
public Vec3 smooth;
|
||||||
|
}
|
||||||
|
|
||||||
// data
|
// data
|
||||||
public Pose cursor = Pose.Identity;
|
public Cursor cursor = new Cursor();
|
||||||
PullRequest.OneEuroFilter xF = new PullRequest.OneEuroFilter(0.001f, 0.1f);
|
PullRequest.OneEuroFilter xF = new PullRequest.OneEuroFilter(0.001f, 0.1f);
|
||||||
PullRequest.OneEuroFilter yF = 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);
|
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.Tip).position,
|
||||||
hand.Get(FingerId.Index, JointId.KnuckleMajor).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.Sphere.Draw(Mono.inst.matHolo, Matrix.TRS(cursor.raw, Quat.Identity, 0.01f), new Color(1, 0, 0));
|
||||||
Mesh.Cube.Draw(Mono.inst.matHolo, Matrix.TRS(rawPos, 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));
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,16 +65,16 @@ class WaveCursor : dof {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Vec3[] mm = new Vec3[64];
|
Vec3[] mm = new Vec3[81];
|
||||||
|
|
||||||
Vec3[] xL = new Vec3[64];
|
Vec3[] xL = new Vec3[81];
|
||||||
Vec3[] xR = new Vec3[64];
|
Vec3[] xR = new Vec3[81];
|
||||||
Vec3[] yL = new Vec3[64];
|
Vec3[] yL = new Vec3[81];
|
||||||
Vec3[] yR = new Vec3[64];
|
Vec3[] yR = new Vec3[81];
|
||||||
Vec3[] zL = new Vec3[64];
|
Vec3[] zL = new Vec3[81];
|
||||||
Vec3[] zR = new Vec3[64];
|
Vec3[] zR = new Vec3[81];
|
||||||
public void Demo(Quat ori) {
|
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(xL, smoothPos + cursor.orientation * new Vec3(-1, 0, 0) * 0.1f);
|
||||||
// Trail(xR, 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) {
|
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);
|
int len = (int)(points.Length * Mono.inst.trailLen);
|
||||||
for (int i = 0; i < len; i++) {
|
for (int i = 0; i < len; i++) {
|
||||||
if (i > 0) {
|
// if (i > 0) {
|
||||||
Vec3 dir = Vec3.Forward;
|
// Vec3 dir = Vec3.Forward;
|
||||||
if (points[i].v != points[i - 1].v) {
|
// if (points[i].v != points[i - 1].v) {
|
||||||
dir = PullRequest.Direction(points[i], points[i - 1]);
|
// dir = PullRequest.Direction(points[i], points[i - 1]);
|
||||||
}
|
// }
|
||||||
points[i] = points[i - 1] + dir * 0.02f * Mono.inst.trailScl;
|
// // points[i] = points[i - 1] + dir * 0.02f * Mono.inst.trailScl;
|
||||||
}
|
// }
|
||||||
|
|
||||||
Vec3 from = i > 0 ? points[i - 1] : nextPos;
|
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(
|
Mesh.Cube.Draw(
|
||||||
Mono.inst.matHolo,
|
Mono.inst.matHolo,
|
||||||
Matrix.TRS(
|
Matrix.TRS(
|
||||||
|
|
|
@ -39,7 +39,7 @@ class Trackballer : dof {
|
||||||
thumbRot,
|
thumbRot,
|
||||||
new Vec3(handed == Handed.Left ? -1f : 1f, 1f, 1f) * 0.1666f
|
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
|
// closest to anchor
|
||||||
float closest = 100000f;
|
float closest = 100000f;
|
||||||
|
@ -84,7 +84,7 @@ class Trackballer : dof {
|
||||||
|
|
||||||
|
|
||||||
// Lines.Add(thumbTip, thumbKnuckle, Color.White, 0.002f);
|
// 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) {
|
// if (btnIn.held) {
|
||||||
|
@ -118,8 +118,8 @@ class Trackballer : dof {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw
|
// Draw
|
||||||
Mesh.Sphere.Draw(Mono.inst.matHolo, Matrix.TRS(anchor, ori, 0.04f), new Color(inT, 0, 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));
|
// Mesh.Cube.Draw(Mono.inst.matHolo, Matrix.TRS(anchor, ori, 0.04f), new Color(0, outT * 0.2f, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
Quat newOri = momentum * ori;
|
Quat newOri = momentum * ori;
|
||||||
|
@ -139,14 +139,12 @@ class Trackballer : dof {
|
||||||
COMMENTS
|
COMMENTS
|
||||||
|
|
||||||
distinct interactions to account for (relative to palm orientation)
|
distinct interactions to account for (relative to palm orientation)
|
||||||
w/rating assuming perfect tracking
|
y swipe
|
||||||
y swipe (10/10)
|
z swipe
|
||||||
z swipe (05/10)
|
x spin
|
||||||
x spin (02/10)
|
|
||||||
|
|
||||||
how reliable is the provided palm orientation?
|
how reliable is the provided palm orientation?
|
||||||
|
|
||||||
show when you are about to boolean
|
more boolean visual and audio feeback
|
||||||
|
|
||||||
2d pad?
|
|
||||||
*/
|
*/
|
Binary file not shown.
Loading…
Add table
Reference in a new issue