cursor magement++
This commit is contained in:
parent
19b2a23a6d
commit
77448e7712
3 changed files with 33 additions and 12 deletions
|
@ -424,7 +424,7 @@ public class MonoNet {
|
|||
Quat toRot = (con.aim.orientation * heldRot * spinRot).Normalized;
|
||||
Vec3 toPos = cursor + (con.aim.orientation * heldRot * spinRot).Normalized * offset;
|
||||
// cursor - offset;
|
||||
if (con.stick.Magnitude > 0.1f) {
|
||||
if (con.stick.y > 0.1f) {
|
||||
toRot = blocks[index].solid.GetPose().orientation;
|
||||
}
|
||||
blocks[index].solid.Move(toPos, toRot);
|
||||
|
|
25
Program.cs
25
Program.cs
|
@ -131,13 +131,28 @@ public class Mono {
|
|||
// Lines.Add(headPos + Vec3.Up * -0.2f, rShoulder, new Color(1, 0, 0), 0.01f);
|
||||
// Lines.Add(headPos + Vec3.Up * -0.2f, lShoulder, new Color(1, 0, 0), 0.01f);
|
||||
|
||||
if (domCon.IsX1JustPressed) {
|
||||
domPlanted = !domPlanted;
|
||||
// if (domCon.IsX1JustPressed) {
|
||||
// domPlanted = !domPlanted;
|
||||
// }
|
||||
// if (subCon.IsX1JustPressed) {
|
||||
// subPlanted = !subPlanted;
|
||||
// }
|
||||
|
||||
if (domCon.stick.Magnitude > 0.1f) {
|
||||
if (domCon.stick.y < 0f) {
|
||||
domPlanted = true;
|
||||
}
|
||||
if (subCon.IsX1JustPressed) {
|
||||
subPlanted = !subPlanted;
|
||||
} else {
|
||||
domPlanted = false;
|
||||
}
|
||||
|
||||
if (subCon.stick.Magnitude > 0.1f) {
|
||||
if (subCon.stick.y < 0f) {
|
||||
subPlanted = true;
|
||||
}
|
||||
} else {
|
||||
subPlanted = false;
|
||||
}
|
||||
|
||||
cursor.Step(new Pose[] { domCon.pose, new Pose(rShoulder, Quat.LookDir(middl)) }, 1);
|
||||
if (!domPlanted) {
|
||||
|
@ -152,7 +167,7 @@ public class Mono {
|
|||
// cursor.p1 = subCursor.p0; // override *later change all one handed cursors to be dual wielded by default*
|
||||
|
||||
cubicFlow.Step(new Pose[] { new Pose(cursor.p0, domCon.aim.orientation), new Pose(subCursor.p0, subCon.aim.orientation) }, 1);
|
||||
if (domCon.stick.Magnitude > 0.1f || subCon.stick.Magnitude > 0.1f) {
|
||||
if (domCon.stick.y > 0.1f || subCon.stick.y > 0.1f) {
|
||||
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;
|
||||
} else {
|
||||
|
|
|
@ -99,8 +99,9 @@ public class TwistCursor : SpatialCursor {
|
|||
}
|
||||
Vec3 twistFrom = -Vec3.Right;
|
||||
Quat quat;
|
||||
public int chirality = 1;
|
||||
public override void Step(Pose[] poses, float scalar) {
|
||||
// chirality = Math.Sign(scalar);
|
||||
|
||||
Vec3 pos = poses[0].position;
|
||||
quat = poses[0].orientation;
|
||||
Quat from = Quat.LookAt(Vec3.Zero, quat * Vec3.Forward, twistFrom);
|
||||
|
@ -108,6 +109,8 @@ public class TwistCursor : SpatialCursor {
|
|||
// float wrap = twist - twistFrom; // wrap around 0 to 1
|
||||
// (wrap > 0.5f) ? 1 - wrap : wrap;
|
||||
|
||||
outty = Vec3.Dot(from * Vec3.Up, quat * Vec3.Right * chirality) > 0;
|
||||
|
||||
p0 = pos + quat * Vec3.Forward * twist * str;
|
||||
// model.Draw(Matrix.TS(p0, 0.02f));
|
||||
|
||||
|
@ -118,6 +121,8 @@ public class TwistCursor : SpatialCursor {
|
|||
|
||||
twistFrom = quat * Vec3.Up; // -Vec3.Right * chirality;
|
||||
}
|
||||
|
||||
public bool outty;
|
||||
}
|
||||
|
||||
public class CubicFlow : SpatialCursor {
|
||||
|
@ -135,8 +140,9 @@ public class CubicFlow : SpatialCursor {
|
|||
Pose sub = poses[1];
|
||||
Controller domCon = Input.Controller(Handed.Right);
|
||||
Controller subCon = Input.Controller(Handed.Left);
|
||||
subTwist.chirality = -1;
|
||||
|
||||
if (domCon.stick.Magnitude < 0.1f) {
|
||||
if (domCon.stick.y < 0.1f) {
|
||||
domTwist.Calibrate();
|
||||
domTwisting = false;
|
||||
} else {
|
||||
|
@ -147,7 +153,7 @@ public class CubicFlow : SpatialCursor {
|
|||
}
|
||||
domTwist.Step(new Pose[] { dom }, scalar);
|
||||
|
||||
if (subCon.stick.Magnitude < 0.1f) {
|
||||
if (subCon.stick.y < 0.1f) {
|
||||
subTwist.Calibrate();
|
||||
subTwisting = false;
|
||||
} else {
|
||||
|
@ -164,12 +170,12 @@ public class CubicFlow : SpatialCursor {
|
|||
p3 = sub.position;
|
||||
|
||||
|
||||
if (domUp) { // domUp
|
||||
if (domTwist.outty) { // domUp
|
||||
p0 = domTwist.p0;
|
||||
p1 = dom.position;
|
||||
}
|
||||
|
||||
if (subUp) {
|
||||
if (subTwist.outty) {
|
||||
p2 = sub.position;
|
||||
p3 = subTwist.p0;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue