hot fixes

This commit is contained in:
spatialfree 2021-12-06 05:45:54 -05:00
parent 4d82f6bbd9
commit ae7c90060b
3 changed files with 54 additions and 20 deletions

View file

@ -467,6 +467,9 @@ public class MonoNet {
Bezier.Draw(cursor0, cursor1, cursor2, cursor3, Color.White); Bezier.Draw(cursor0, cursor1, cursor2, cursor3, Color.White);
} }
Cube(Matrix.TRS(cursor0, Input.Controller(Handed.Right).pose.orientation, 0.1f), color);
Cube(Matrix.TRS(cursor3, Input.Controller(Handed.Right).pose.orientation, 0.1f), color);
for (int i = 0; i < blocks.Length; i++) { for (int i = 0; i < blocks.Length; i++) {
if (blocks[i].solid.GetPose().position.y < -10) { if (blocks[i].solid.GetPose().position.y < -10) {

View file

@ -73,6 +73,11 @@ public class Mono {
Mesh quad = Default.MeshQuad; Mesh quad = Default.MeshQuad;
Vec3 gripPos = Vec3.Zero;
bool domGripping = false, subGripping = false;
bool gripLeft = false;
float grindDir = 1f; float grindDir = 1f;
bool grinding = false; bool grinding = false;
bool grinded = false; bool grinded = false;
@ -120,24 +125,27 @@ public class Mono {
cursor.Step(new Pose[] { domCon.aim, new Pose(rShoulder, Quat.LookDir(middl)) }, ((Input.Controller(Handed.Right).stick.y + 1) / 2)); cursor.Step(new Pose[] { domCon.aim, new Pose(rShoulder, Quat.LookDir(middl)) }, ((Input.Controller(Handed.Right).stick.y + 1) / 2));
// if (domCon.trigger > 0.5f) { if (!domCon.IsX1Pressed) {
// cursor.Calibrate(); cursor.Calibrate();
// } }
subCursor.Step(new Pose[] { subCon.aim, new Pose(lShoulder, Quat.LookDir(middl)) }, ((Input.Controller(Handed.Left).stick.y + 1) / 2)); subCursor.Step(new Pose[] { subCon.aim, new Pose(lShoulder, Quat.LookDir(middl)) }, ((Input.Controller(Handed.Left).stick.y + 1) / 2));
// if (subCon.trigger > 0.5f) { if (!subCon.IsX1Pressed) {
// subCursor.Calibrate(); subCursor.Calibrate();
// } cursor.p1 = subCursor.p0; // override *later change all one handed cursors to be dual wielded by default* }
// cursor.p1 = subCursor.p0; // override *later change all one handed cursors to be dual wielded by default*
cubicFlow.Step(new Pose[] { domCon.aim, subCon.aim }, 1); cubicFlow.Step(new Pose[] { domCon.aim, subCon.aim }, 1);
if (domCon.stick.MagnitudeSq != 0 || subCon.stick.MagnitudeSq != 0) { if (domCon.stick.MagnitudeSq != 0 || subCon.stick.MagnitudeSq != 0) {
Bezier.Draw(cubicFlow.p0, cubicFlow.p1, cubicFlow.p2, cubicFlow.p3, Color.White); Bezier.Draw(cubicFlow.p0, cubicFlow.p1, cubicFlow.p2, cubicFlow.p3, Color.White);
net.me.cursor0 = cubicFlow.p0; net.me.cursor1 = cubicFlow.p1; net.me.cursor2 = cubicFlow.p2; net.me.cursor3 = cubicFlow.p3; net.me.cursor0 = cubicFlow.p0; net.me.cursor1 = cubicFlow.p1; net.me.cursor2 = cubicFlow.p2; net.me.cursor3 = cubicFlow.p3;
} else { } else {
cube.Draw(mat, Matrix.TS(cursor.p0, 0.1f));
cube.Draw(mat, Matrix.TS(subCursor.p0, 0.1f));
net.me.cursor0 = cursor.p0; net.me.cursor1 = cursor.p0; net.me.cursor2 = subCursor.p0; net.me.cursor3 = subCursor.p0; net.me.cursor0 = cursor.p0; net.me.cursor1 = cursor.p0; net.me.cursor2 = subCursor.p0; net.me.cursor3 = subCursor.p0;
} }
// throw yourself (delta -> vel -> momentum)
// bring rails back
// boolean over network to determine if a peers cubic flow should be drawn
for (int i = 0; i < net.me.blocks.Length; i++) { for (int i = 0; i < net.me.blocks.Length; i++) {
Pose blockPose = net.me.blocks[i].solid.GetPose(); Pose blockPose = net.me.blocks[i].solid.GetPose();
@ -160,23 +168,48 @@ public class Mono {
// pos += fullstick * subCon.trigger * Time.Elapsedf; // pos += fullstick * subCon.trigger * Time.Elapsedf;
// DRAG DRIFT // DRAG DRIFT
Vec3 domPos = domCon.aim.position; Vec3 domPos = net.me.cursor0;
// if (domCon.grip) { // if (domCon.grip) {
// // movePress = Time.Totalf; // // movePress = Time.Totalf;
// domDragStart = domPos; // domDragStart = domPos;
// } // }
vel += -(domPos - domDragStart) * 24 * domCon.grip; // vel += -(domPos - domDragStart) * 24 * domCon.grip;
domDragStart = domPos; // domDragStart = domPos;
Vec3 subPos = subCon.aim.position; Vec3 subPos = net.me.cursor3;
// if (subCon.grip) { // if (subCon.grip) {
// // movePress = Time.Totalf; // // movePress = Time.Totalf;
// subDragStart = subPos; // subDragStart = subPos;
// } // }
// if (subCon.IsX1Pressed) { // if (subCon.IsX1Pressed) {
// } // }
vel += -(subPos - subDragStart) * 24 * subCon.grip; // vel += -(subPos - subDragStart) * 24 * subCon.grip;
subDragStart = subPos; // subDragStart = subPos;
if (domCon.grip > 0.5f) {
if (!domGripping) {
gripPos = domPos;
gripLeft = false;
domGripping = true;
}
} else {
domGripping = false;
}
if (subCon.grip > 0.5f) {
if (!subGripping) {
gripPos = subPos;
gripLeft = true;
subGripping = true;
}
} else {
subGripping = false;
}
if (domGripping || subGripping) {
Vec3 gripTo = gripLeft ? subPos : domPos;
pos = -(gripTo - Input.Head.position) + gripPos - (Input.Head.position - pos);
vel = Vec3.Zero;
}
// CUBIC BEZIER RAIL // CUBIC BEZIER RAIL
// Vec3[] rail = new Vec3[] { // Vec3[] rail = new Vec3[] {

View file

@ -125,7 +125,6 @@ public class CubicFlow : SpatialCursor {
domTwist.Step(new Pose[] { dom }, scalar); domTwist.Step(new Pose[] { dom }, scalar);
subTwist.Step(new Pose[] { sub }, -scalar); subTwist.Step(new Pose[] { sub }, -scalar);
p0 = dom.position; p0 = dom.position;
p1 = domTwist.p0; p1 = domTwist.p0;
p2 = subTwist.p0; p2 = subTwist.p0;
@ -134,17 +133,16 @@ public class CubicFlow : SpatialCursor {
Controller domCon = Input.Controller(Handed.Right); Controller domCon = Input.Controller(Handed.Right);
Controller subCon = Input.Controller(Handed.Left); Controller subCon = Input.Controller(Handed.Left);
Vec3 np0 = Vec3.Lerp(p0, p1, (1 + domCon.stick.y) / 2); Vec3 np0 = Vec3.Lerp(p0, p1, (1 + domCon.stick.x) / 2);
Vec3 np1 = Vec3.Lerp(p1, p0, (1 + domCon.stick.y) / 2); Vec3 np1 = Vec3.Lerp(p1, p0, (1 + domCon.stick.x) / 2);
Vec3 np2 = Vec3.Lerp(p2, p3, (1 + subCon.stick.y) / 2); Vec3 np2 = Vec3.Lerp(p2, p3, (1 + -subCon.stick.x) / 2);
Vec3 np3 = Vec3.Lerp(p3, p2, (1 + subCon.stick.y) / 2); Vec3 np3 = Vec3.Lerp(p3, p2, (1 + -subCon.stick.x) / 2);
p0 = np0; p0 = np0;
p1 = np1; p1 = np1;
p2 = np2; p2 = np2;
p3 = np3; p3 = np3;
// if toggle // if toggle
} }
public override void Calibrate() {} public override void Calibrate() {}