post conf cleanup w/comments on the btm
This commit is contained in:
parent
f527f95199
commit
101369acef
5 changed files with 164 additions and 154 deletions
115
app/Board.cs
Normal file
115
app/Board.cs
Normal file
|
@ -0,0 +1,115 @@
|
|||
namespace Oriels;
|
||||
|
||||
public class Board {
|
||||
// velocity button controls
|
||||
// "center off mass" thrust vector steering
|
||||
|
||||
Mesh meshCube = Mesh.Cube;
|
||||
|
||||
public bool goofy = false;
|
||||
|
||||
public Vec3 front, back, pos, dir, vector;
|
||||
public float vel;
|
||||
|
||||
float length = 1.5f;
|
||||
public Board() {
|
||||
front = new Vec3(0, 0, -1) * length / 2;
|
||||
back = new Vec3(0, 0, 1) * length / 2;
|
||||
dir = new Vec3(0, 0, -1);
|
||||
vel = 0;
|
||||
}
|
||||
|
||||
public void Frame() {
|
||||
// tilt steer ("back wheel" turns *rudder)
|
||||
// button velocity controls
|
||||
Con con = goofy ? Mono.inst.rig.rCon : Mono.inst.rig.lCon;
|
||||
float accel = con.device.trigger;
|
||||
float deccel = con.device.grip;
|
||||
float lean = Mono.inst.rig.LocalPos(Mono.inst.rig.Head.position).x;
|
||||
|
||||
// float length = 1.5f;
|
||||
float drag = 0.1f;
|
||||
float speed = 4f;
|
||||
float brake = 12f;
|
||||
float tight = 60f;
|
||||
|
||||
|
||||
// velocity
|
||||
vel *= 1f - (drag * Time.Elapsedf);
|
||||
vel += accel * speed * Time.Elapsedf;
|
||||
vel = MathF.Max(vel - deccel * brake * Time.Elapsedf, 0);
|
||||
|
||||
// steering
|
||||
vector = Quat.LookDir(dir) * Quat.FromAngles(0, lean * tight, 0) * Vec3.Forward;
|
||||
back += vector * vel * Time.Elapsedf;
|
||||
dir = (front - back).Normalized;
|
||||
|
||||
front = back + dir * length;
|
||||
pos = Vec3.Lerp(front, back, 0.5f);
|
||||
|
||||
|
||||
Mono.inst.rig.pos = pos;
|
||||
Mono.inst.rig.ori = Quat.LookDir(dir);
|
||||
|
||||
// hover
|
||||
// if (rig.lCon.gripBtn.held) {
|
||||
// rig.pos.y = pid.Update(rig.LocalPos(rig.Head.position).y);
|
||||
// }
|
||||
|
||||
|
||||
meshCube.Draw(Material.Default,
|
||||
Matrix.TRS(
|
||||
Mono.inst.rig.FloorCenter,
|
||||
Quat.LookDir(dir),
|
||||
new Vec3(0.05f, 0.2f, 0.2f)
|
||||
)
|
||||
);
|
||||
|
||||
// mini board in hand for debugging
|
||||
// meshCube.Draw(Material.Default,
|
||||
// Matrix.TRS(
|
||||
// rig.rCon.pos,
|
||||
// board.ori,
|
||||
// new Vec3(0.4f, 0.1f, reach * 2) * 0.1f
|
||||
// )
|
||||
// );
|
||||
// // front wheel
|
||||
// meshCube.Draw(Material.Default,
|
||||
// Matrix.TRS(
|
||||
// rig.rCon.pos + board.dir * reach * 0.1f,
|
||||
// Quat.LookDir(frontDir),
|
||||
// new Vec3(0.05f, 0.2f, 0.2f) * 0.1f
|
||||
// )
|
||||
// );
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// pillars to hover through
|
||||
// spawn in front every 1m away from last
|
||||
if (Vec3.Distance(pos, lastSpawnPos) > 1f) {
|
||||
// odd or even
|
||||
float chirality = pillarIndex % 2 == 0 ? 1f : -1f;
|
||||
pillars[pillarIndex] = pos + Quat.LookDir(dir) * new Vec3(chirality * 8 * Mono.inst.noise.uvalue, 0, -24);
|
||||
|
||||
lastSpawnPos = pos;
|
||||
|
||||
pillarIndex++;
|
||||
if (pillarIndex >= pillars.Length) { pillarIndex = 0; }
|
||||
}
|
||||
|
||||
for (int i = 0; i < pillars.Length; i++) {
|
||||
meshCube.Draw(Material.Default,
|
||||
Matrix.TRS(
|
||||
pillars[i],
|
||||
Quat.Identity,
|
||||
new Vec3(0.1f, 20f, 0.1f)
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
Vec3[] pillars = new Vec3[64];
|
||||
int pillarIndex = 0;
|
||||
Vec3 lastSpawnPos = Vec3.Zero;
|
||||
}
|
139
app/Mono.cs
139
app/Mono.cs
|
@ -45,9 +45,9 @@ public class Mono {
|
|||
|
||||
dofs = new dof[] {
|
||||
// new StretchFinger(),
|
||||
new WaveCursor() { handed = Handed.Left },
|
||||
new WaveCursor() { handed = Handed.Right },
|
||||
new Trackballer() { handed = Handed.Left },
|
||||
new WaveCursor() { handed = Handed.Left },
|
||||
new WaveCursor() { handed = Handed.Right },
|
||||
new Trackballer() { handed = Handed.Left },
|
||||
new Trackballer() { handed = Handed.Right },
|
||||
// new StretchCursor() { },
|
||||
// new StretchCursor() { },
|
||||
|
@ -77,10 +77,6 @@ public class Mono {
|
|||
|
||||
// Space.Mono spaceMono = new Space.Mono();
|
||||
Greenyard.Mono greenyard = new Greenyard.Mono();
|
||||
Board board = new Board();
|
||||
|
||||
|
||||
PullRequest.PID pid = new PullRequest.PID(8, 0.8f);
|
||||
|
||||
// -------------------------------------------------
|
||||
|
||||
|
@ -90,11 +86,6 @@ public class Mono {
|
|||
|
||||
// -------------------------------------------------
|
||||
|
||||
// THE BACK BREAKING PROBLEM WITH THE CURRENT DOF SYSTEM
|
||||
// is that I can't pass input to it in a dynamic way
|
||||
// a pointer would solve this problem but c# doesn't have pointers
|
||||
// except for unsafe code, which opens up a whole new can of worms
|
||||
|
||||
// dof.Frame();
|
||||
dofs[0].Frame();
|
||||
dofs[1].Frame();
|
||||
|
@ -128,7 +119,6 @@ public class Mono {
|
|||
);
|
||||
|
||||
|
||||
|
||||
// rGlove.Step(); lGlove.Step();
|
||||
|
||||
// rBlock.Step(); lBlock.Step();
|
||||
|
@ -145,7 +135,6 @@ public class Mono {
|
|||
|
||||
// spaceMono.Frame();
|
||||
greenyard.Frame();
|
||||
// board.Frame();
|
||||
|
||||
// -------------------------------------------------
|
||||
|
||||
|
@ -196,123 +185,15 @@ public class Mono {
|
|||
public float stretchStr = 0.333f;
|
||||
public float playerY = 0;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
COMMENTS
|
||||
|
||||
[Serializable]
|
||||
public class Board {
|
||||
// velocity button controls
|
||||
// "center off mass" thrust vector steering
|
||||
debug bool
|
||||
rendering the raw output
|
||||
particularly for hand tracking dofs (so Moses can better test them!)
|
||||
raw = 0.333f alpha ~
|
||||
|
||||
Mesh meshCube = Mesh.Cube;
|
||||
|
||||
public bool goofy = false;
|
||||
|
||||
public Vec3 front, back, pos, dir, vector;
|
||||
public float vel;
|
||||
|
||||
float length = 1.5f;
|
||||
public Board() {
|
||||
front = new Vec3(0, 0, -1) * length / 2;
|
||||
back = new Vec3(0, 0, 1) * length / 2;
|
||||
dir = new Vec3(0, 0, -1);
|
||||
vel = 0;
|
||||
}
|
||||
|
||||
public void Frame() {
|
||||
// tilt steer ("back wheel" turns *rudder)
|
||||
// button velocity controls
|
||||
Con con = goofy ? Mono.inst.rig.rCon : Mono.inst.rig.lCon;
|
||||
float accel = con.device.trigger;
|
||||
float deccel = con.device.grip;
|
||||
float lean = Mono.inst.rig.LocalPos(Mono.inst.rig.Head.position).x;
|
||||
|
||||
// float length = 1.5f;
|
||||
float drag = 0.1f;
|
||||
float speed = 4f;
|
||||
float brake = 12f;
|
||||
float tight = 60f;
|
||||
|
||||
|
||||
// velocity
|
||||
vel *= 1f - (drag * Time.Elapsedf);
|
||||
vel += accel * speed * Time.Elapsedf;
|
||||
vel = MathF.Max(vel - deccel * brake * Time.Elapsedf, 0);
|
||||
|
||||
// steering
|
||||
vector = Quat.LookDir(dir) * Quat.FromAngles(0, lean * tight, 0) * Vec3.Forward;
|
||||
back += vector * vel * Time.Elapsedf;
|
||||
dir = (front - back).Normalized;
|
||||
|
||||
front = back + dir * length;
|
||||
pos = Vec3.Lerp(front, back, 0.5f);
|
||||
|
||||
|
||||
Mono.inst.rig.pos = pos;
|
||||
Mono.inst.rig.ori = Quat.LookDir(dir);
|
||||
|
||||
// hover
|
||||
// if (rig.lCon.gripBtn.held) {
|
||||
// rig.pos.y = pid.Update(rig.LocalPos(rig.Head.position).y);
|
||||
// }
|
||||
|
||||
|
||||
meshCube.Draw(Material.Default,
|
||||
Matrix.TRS(
|
||||
Mono.inst.rig.FloorCenter,
|
||||
Quat.LookDir(dir),
|
||||
new Vec3(0.05f, 0.2f, 0.2f)
|
||||
)
|
||||
);
|
||||
|
||||
// mini board in hand for debugging
|
||||
// meshCube.Draw(Material.Default,
|
||||
// Matrix.TRS(
|
||||
// rig.rCon.pos,
|
||||
// board.ori,
|
||||
// new Vec3(0.4f, 0.1f, reach * 2) * 0.1f
|
||||
// )
|
||||
// );
|
||||
// // front wheel
|
||||
// meshCube.Draw(Material.Default,
|
||||
// Matrix.TRS(
|
||||
// rig.rCon.pos + board.dir * reach * 0.1f,
|
||||
// Quat.LookDir(frontDir),
|
||||
// new Vec3(0.05f, 0.2f, 0.2f) * 0.1f
|
||||
// )
|
||||
// );
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// pillars to hover through
|
||||
// spawn in front every 1m away from last
|
||||
if (Vec3.Distance(pos, lastSpawnPos) > 1f) {
|
||||
// odd or even
|
||||
float chirality = pillarIndex % 2 == 0 ? 1f : -1f;
|
||||
pillars[pillarIndex] = pos + Quat.LookDir(dir) * new Vec3(chirality * 8 * Mono.inst.noise.uvalue, 0, -24);
|
||||
|
||||
lastSpawnPos = pos;
|
||||
|
||||
pillarIndex++;
|
||||
if (pillarIndex >= pillars.Length) { pillarIndex = 0; }
|
||||
}
|
||||
|
||||
for (int i = 0; i < pillars.Length; i++) {
|
||||
meshCube.Draw(Material.Default,
|
||||
Matrix.TRS(
|
||||
pillars[i],
|
||||
Quat.Identity,
|
||||
new Vec3(0.1f, 20f, 0.1f)
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
Vec3[] pillars = new Vec3[64];
|
||||
int pillarIndex = 0;
|
||||
Vec3 lastSpawnPos = Vec3.Zero;
|
||||
}
|
||||
*/
|
|
@ -340,3 +340,14 @@ public class Oriel {
|
|||
new Vec3(1, -1, -1), new Vec3(-1, -1, -1)
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
COMMENTS
|
||||
|
||||
try rendering as additive for an AR effect!
|
||||
|
||||
compositor
|
||||
multi-oriel requires a compositor approach
|
||||
even if you just start with input management
|
||||
*/
|
|
@ -27,8 +27,6 @@ class WaveCursor : dof {
|
|||
cursor.orientation = hand.palm.orientation;
|
||||
|
||||
}
|
||||
|
||||
// Demo();
|
||||
}
|
||||
|
||||
public float deadzone = 0.03f;
|
||||
|
@ -97,3 +95,9 @@ class WaveCursor : dof {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
COMMENTS
|
||||
|
||||
*/
|
|
@ -72,32 +72,31 @@ class Trackballer : dof {
|
|||
Mesh.Cube.Draw(Mono.inst.matHolo, Matrix.TRS(anchor, ori, 0.04f), new Color(0, outT, 0));
|
||||
}
|
||||
|
||||
|
||||
|
||||
// pad momentum!
|
||||
// like we did w/ vader life alyx immortal
|
||||
// all the difference in the world!
|
||||
// and makes for the third iteration of the trackballer
|
||||
|
||||
|
||||
|
||||
Quat newOri = momentum * ori;
|
||||
if (new Vec3(newOri.x, newOri.y, newOri.z).LengthSq > 0) {
|
||||
ori = newOri;
|
||||
}
|
||||
|
||||
// show that you are about to boolean in and out
|
||||
|
||||
// trackballer demo
|
||||
// fly around a "ship" with the cursor
|
||||
// and turn it with the thumb trackballer
|
||||
}
|
||||
|
||||
// design
|
||||
public Handed handed = Handed.Left;
|
||||
public float[] layer = new float[] { 0.00333f, 0.02f, 0.0666f };
|
||||
|
||||
|
||||
|
||||
public float scale = 1;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
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)
|
||||
|
||||
how reliable is the provided palm orientation?
|
||||
|
||||
show when you are about to boolean
|
||||
|
||||
2d pad?
|
||||
*/
|
Loading…
Add table
Reference in a new issue