board basics
This commit is contained in:
parent
2574429a41
commit
f6db3e8981
4 changed files with 75 additions and 14 deletions
41
app/Mono.cs
41
app/Mono.cs
|
@ -56,20 +56,22 @@ public class Mono {
|
|||
Renderer.SetClip(0.02f, 1000f);
|
||||
}
|
||||
|
||||
Vec3 pos = new Vec3(0f, 0f, 0f); // see below
|
||||
Vec3 pos = new Vec3(0f, 0f, 0f);
|
||||
Quat ori = Quat.Identity;
|
||||
float yy = 0f;
|
||||
public void Step() {
|
||||
Renderer.CameraRoot = Matrix.T(pos);
|
||||
Renderer.CameraRoot = Matrix.TR(pos, ori);
|
||||
|
||||
rig.Step();
|
||||
scene.Step();
|
||||
|
||||
// -------------------------------------------------
|
||||
|
||||
rGlove.Step(); lGlove.Step();
|
||||
// rGlove.Step(); lGlove.Step();
|
||||
|
||||
rBlock.Step(); lBlock.Step();
|
||||
// rBlock.Step(); lBlock.Step();
|
||||
|
||||
cubicCon.Step();
|
||||
// cubicCon.Step();
|
||||
|
||||
// Vec3 fullstick = rig.Fullstick(false);
|
||||
|
||||
|
@ -77,7 +79,34 @@ public class Mono {
|
|||
|
||||
// oriel.Step();
|
||||
|
||||
pos.z += Time.Elapsedf * 0.1f;
|
||||
// board
|
||||
// use the active con position to point from the head *top down perspective (y = 0)
|
||||
// to determine the board direction
|
||||
Con handleCon = rig.HandleCon();
|
||||
Vec3 boardDir = (handleCon.pos.X0Z - rig.Head().position.X0Z).Normalized;
|
||||
Quat boardRot = Quat.LookDir(boardDir);
|
||||
|
||||
// boardDir = (handleCon.pos.X0Z - head.position.X0Z).normalized
|
||||
// boardRot = Quat.LookDir(boardDir)
|
||||
// boardPos += boardDir * handleCon.trigger * speed * delta
|
||||
|
||||
pos += boardDir * handleCon.device.trigger * Time.Elapsedf;
|
||||
yy += handleCon.device.stick.x * 90 * Time.Elapsedf;
|
||||
ori = Quat.FromAngles(0f, yy, 0f); // stick.x -> twist z
|
||||
|
||||
|
||||
Vec3 boardPos = pos + Vec3.Up * -1.35f; // rig.Head().position.X0Z
|
||||
Mesh.Cube.Draw(Material.Default, Matrix.TRS(boardPos, boardRot, new Vec3(0.18f, 0.06f, 0.6f)));
|
||||
|
||||
// having a board underneath my feet and a virtual handlebar in my hand
|
||||
// did a lot to improve the quality of the experience (+immersion -sickness)
|
||||
|
||||
// don't do more just yet!
|
||||
// these are all important, but lets start small and scrappy + it's 9AM
|
||||
// twist turning
|
||||
// handleCon
|
||||
// tighter boardDir
|
||||
// lean turning (head moving in relation to hand, doesn't that happen a little already?)
|
||||
|
||||
// -------------------------------------------------
|
||||
|
||||
|
|
|
@ -360,13 +360,13 @@ public class Peer {
|
|||
PullRequest.BlockOut(Matrix.TRS(headset.position + Input.Head.Forward * -0.15f, headset.orientation, Vec3.One * 0.3f), color);
|
||||
}
|
||||
|
||||
Bezier.Draw(
|
||||
mono.rGlove.virtualGlove.position,
|
||||
mono.rig.rCon.pos,
|
||||
mono.rig.lCon.pos,
|
||||
mono.lGlove.virtualGlove.position,
|
||||
new Color(1, 1, 1, 0.1f)
|
||||
);
|
||||
// Bezier.Draw(
|
||||
// mono.rGlove.virtualGlove.position,
|
||||
// mono.rig.rCon.pos,
|
||||
// mono.rig.lCon.pos,
|
||||
// mono.lGlove.virtualGlove.position,
|
||||
// new Color(1, 1, 1, 0.1f)
|
||||
// );
|
||||
|
||||
for (int i = 0; i < blocks.Length; i++) {
|
||||
NetBlock block = blocks[i];
|
||||
|
|
|
@ -10,6 +10,16 @@ public class Rig {
|
|||
|
||||
public Con rCon = new Con(), lCon = new Con();
|
||||
public Con Con(bool chirality) { return chirality ? rCon : lCon; }
|
||||
bool handleChirality = false;
|
||||
public Con HandleCon() {
|
||||
return Con(handleChirality);
|
||||
}
|
||||
|
||||
public Pose Head() {
|
||||
Pose pose = Input.Head;
|
||||
pose.position += pose.orientation * Vec3.Forward * -0.1f;
|
||||
return pose;
|
||||
}
|
||||
|
||||
public Pose rShoulder, lShoulder;
|
||||
public Pose Shoulder(bool chirality) { return chirality ? rShoulder : lShoulder; }
|
||||
|
@ -22,8 +32,11 @@ public class Rig {
|
|||
rCon.Step(true);
|
||||
lCon.Step(false);
|
||||
|
||||
if (rCon.gripBtn.frameDown) { handleChirality = true; }
|
||||
if (lCon.gripBtn.frameDown) { handleChirality = false; }
|
||||
|
||||
// Shoulders
|
||||
Vec3 headPos = Input.Head.position + Input.Head.Forward * -0.15f;
|
||||
Vec3 headPos = Input.Head.position + Input.Head.Forward * -0.15f; // Input.Head -> Head() ?
|
||||
Vec3 shoulderDir = (
|
||||
(lCon.pos.X0Z - headPos.X0Z).Normalized +
|
||||
(rCon.pos.X0Z - headPos.X0Z).Normalized
|
||||
|
|
19
app/Scene.cs
19
app/Scene.cs
|
@ -48,6 +48,25 @@ public class Scene {
|
|||
data.matrix = (Matrix)System.Numerics.Matrix4x4.Transpose(oriel.matrix);
|
||||
data.dimensions = oriel.bounds.dimensions;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
data.dimensions = Vec3.Zero;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
buffer.Set(data);
|
||||
|
||||
// PullRequest.BlockOut(floor.GetPose().ToMatrix(floorScale), Color.White * 0.333f, matFloor);
|
||||
|
|
Loading…
Add table
Reference in a new issue