keyboard
This commit is contained in:
parent
57239a212b
commit
162d4f8b98
1 changed files with 57 additions and 12 deletions
|
@ -228,18 +228,8 @@ public class Mono {
|
|||
|
||||
mat.Run(); // run here or at the end?... or maybe both?
|
||||
|
||||
if (Input.Key(Key.Left).IsJustActive()) {
|
||||
monoNet.value = 1;
|
||||
monoNet.send = true;
|
||||
}
|
||||
|
||||
if (Input.Key(Key.Right).IsJustActive()) {
|
||||
monoNet.value = 2;
|
||||
monoNet.send = true;
|
||||
}
|
||||
|
||||
if (Input.Key(Key.Down).IsJustActive()) {
|
||||
monoNet.value = -1;
|
||||
monoNet.value = 0;
|
||||
monoNet.send = true;
|
||||
}
|
||||
|
||||
|
@ -250,7 +240,7 @@ public class Mono {
|
|||
Vec3 thumb_tip = palm_ori.Inverse * rig.hand_1.Get(FingerId.Thumb, JointId.Tip).position;
|
||||
Vec3 thumb_minor = palm_ori.Inverse * rig.hand_1.Get(FingerId.Thumb, JointId.KnuckleMinor).position;
|
||||
if (thumb_tip.x < thumb_minor.x - 0f * U.cm) {
|
||||
Log.Info("thumb is out");
|
||||
// Log.Info("thumb is out");
|
||||
xi = 0;
|
||||
}
|
||||
|
||||
|
@ -291,6 +281,61 @@ public class Mono {
|
|||
}
|
||||
}
|
||||
|
||||
// keyboard
|
||||
Matrix keyboard_m4 = Matrix.TRS(
|
||||
rig.head_pos + V.XYZ(0, -0.1f, -0.2f),
|
||||
rig.head_ori * Quat.FromAngles(0, 180, 0),
|
||||
0.2f
|
||||
);
|
||||
Hierarchy.Push(keyboard_m4);
|
||||
// 3 rows of 10 keys
|
||||
for (int i = 0; i < 3; i++) {
|
||||
for (int j = 0; j < 10; j++) {
|
||||
// background quad
|
||||
Mesh.Quad.Draw(
|
||||
mat.unlit_clear,
|
||||
Matrix.TRS(
|
||||
V.XYZ(j * -0.1f, i * -0.1f, 0.0f) + V.XYZ(0.45f, 0.0f, 0.0f),
|
||||
Quat.FromAngles(0, 0, 0),
|
||||
0.09f
|
||||
),
|
||||
Color.Hex(0x00000020)
|
||||
);
|
||||
|
||||
int index = i * 10 + j;
|
||||
// string text = characters[index].character;
|
||||
string keychar = KeyToChar(index);
|
||||
|
||||
Text.Add(
|
||||
keychar,
|
||||
Matrix.TS(
|
||||
V.XYZ(j * -0.1f, i * -0.1f, 0.0f) + V.XYZ(0.45f, 0.0f, 0.0f),
|
||||
1.0f
|
||||
),
|
||||
TextAlign.Center,
|
||||
TextAlign.Center,
|
||||
0, 0, 0
|
||||
);
|
||||
// show the braille dots(spheres) above the text
|
||||
for (int k = 0; k < 6; k++) {
|
||||
float spacing = 0.02f;
|
||||
float x_offset = (k % 2) * spacing;
|
||||
float y_offset = (k / 2) * -spacing;
|
||||
if (char_cell[keychar][k] == 1) {
|
||||
Mesh.Sphere.Draw(
|
||||
mat.unlit_clear,
|
||||
Matrix.TS(
|
||||
V.XYZ(j * -0.1f - x_offset, i * -0.1f + y_offset, 0.0f) + V.XYZ(0.45f + 0.01f, 0.018f, 0.0f),
|
||||
0.01f
|
||||
),
|
||||
Color.Hex(0x80808040)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Hierarchy.Pop();
|
||||
|
||||
// WORLD
|
||||
mesh_room.Draw(
|
||||
mat_room,
|
||||
|
|
Loading…
Add table
Reference in a new issue