reach cursor -> backhanded
This commit is contained in:
parent
ebd00e0021
commit
10029f21d3
4 changed files with 84 additions and 58 deletions
|
@ -108,11 +108,13 @@ float oriel(float3 ro, float3 rd) {
|
|||
|
||||
|
||||
float map(float3 pos) {
|
||||
|
||||
float3 posOriel = mul(float4(pos, 1), _matrix).xyz;
|
||||
// pos.x = _center.x + pos.x;
|
||||
// pos.y = _center.y + pos.y;
|
||||
// pos.z = _center.z - pos.z;
|
||||
float3 spin = float3(sin(time), 0, cos(time)) * 0.5;
|
||||
float sphere = sdSphere(pos + spin - _center, 0.1);
|
||||
// float3 spin = float3(sin(time), 0, cos(time)) * 0.5;
|
||||
// float sphere = sdSphere(pos + spin - _center, 0.1);
|
||||
// return sdLink(pos, 0.1, 0.1, 0.1);
|
||||
// float octo = sdOctahedron(pos - _center - position, 0.2);
|
||||
// float frame = sdBoxFrame(pos - _center - position, float3(0.06, 0.06, 0.06), 0.004);
|
||||
|
@ -123,13 +125,14 @@ float map(float3 pos) {
|
|||
// float orielCrown = sdBoxFrame(pos - _center, d, 0.000);
|
||||
|
||||
// float box = sdBox(pos, float3(0.1, 0.1, 0.1));
|
||||
float box = sdBox((float3)mul(float4(pos, 1), _matrix), float3(0.1, 0.1, 0.1));
|
||||
float box = sdBox(posOriel, float3(0.7, 0.015, 0.07));
|
||||
|
||||
|
||||
// return lerp(sphere, octo, time);
|
||||
float plane = sdPlane(pos + float3(0, 1.5, 0), float3(0, 1, 0), 0);
|
||||
|
||||
// float blendd = lerp(octo, frame, time);
|
||||
return min(min(plane, sphere), box);
|
||||
return min(plane, box);
|
||||
}
|
||||
|
||||
float raymarch(float3 ro, float3 rd) {
|
||||
|
|
119
app/Monolith.cs
119
app/Monolith.cs
|
@ -73,8 +73,8 @@ public class Monolith {
|
|||
ColorCube colorCube = new ColorCube();
|
||||
Vec3 oldLPos = Vec3.Zero;
|
||||
|
||||
SpatialCursor rightCursor = new ReachCursor(this, true);
|
||||
SpatialCursor leftCursor = new ReachCursor(this, false);
|
||||
ReachCursor rightReachCursor = new ReachCursor(this, true);
|
||||
ReachCursor leftReachCursor = new ReachCursor(this, false);
|
||||
bool rightPlanted = false;
|
||||
bool leftPlanted = false;
|
||||
|
||||
|
@ -130,11 +130,11 @@ public class Monolith {
|
|||
);
|
||||
|
||||
rWrist = new Pose(
|
||||
rCon.pose.position + rCon.aim.orientation * new Vec3(0, -0.0333f, 0.052f),
|
||||
rCon.pose.position + rCon.aim.orientation * new Vec3(0, 0, 0.052f),
|
||||
rCon.aim.orientation
|
||||
);
|
||||
lWrist = new Pose(
|
||||
lCon.pose.position + lCon.aim.orientation * new Vec3(0, -0.0333f, 0.052f),
|
||||
lCon.pose.position + lCon.aim.orientation * new Vec3(0, 0, 0.052f),
|
||||
lCon.aim.orientation
|
||||
);
|
||||
|
||||
|
@ -188,23 +188,43 @@ public class Monolith {
|
|||
}
|
||||
|
||||
if (!rightPlanted) {
|
||||
rightCursor.p0 = rCon.pose.position;
|
||||
rightCursor.Calibrate();
|
||||
rightReachCursor.p0 = rCon.pose.position;
|
||||
rightReachCursor.Calibrate();
|
||||
}
|
||||
rightCursor.Step(new Pose[] { rCon.pose }, 1);
|
||||
if (!leftPlanted) {
|
||||
leftCursor.p0 = lCon.pose.position;
|
||||
leftCursor.Calibrate();
|
||||
leftReachCursor.p0 = lCon.pose.position;
|
||||
leftReachCursor.Calibrate();
|
||||
}
|
||||
leftCursor.Step(new Pose[] { lCon.pose }, 1); // ((Input.Controller(Handed.Left).stick.y + 1) / 2)
|
||||
// cursor.p1 = subCursor.p0; // override *later change all one handed cursors to be dual wielded by default*
|
||||
|
||||
cubicFlow.Step(new Pose[] { new Pose(rightCursor.p0, rCon.aim.orientation), new Pose(leftCursor.p0, lCon.aim.orientation) }, 1);
|
||||
if (rCon.grip > 0.5f) {
|
||||
leftReachCursor.origin = lShoulder.orientation.Inverse * (rCon.pose.position - lShoulder.position);
|
||||
}
|
||||
if (lCon.grip > 0.5f) {
|
||||
rightReachCursor.origin = rShoulder.orientation.Inverse * (lCon.pose.position - rShoulder.position);
|
||||
}
|
||||
|
||||
|
||||
rightReachCursor.Step(new Pose[] { rCon.pose }, 0.2f);
|
||||
leftReachCursor.Step(new Pose[] { lCon.pose }, 0.2f);
|
||||
|
||||
// enum GripState {
|
||||
// None,
|
||||
// Grip,
|
||||
// Release,
|
||||
// }
|
||||
|
||||
// GripState rightState = GripState.None;
|
||||
// GripState leftState = GripState.None;
|
||||
|
||||
// switch ()
|
||||
|
||||
|
||||
cubicFlow.Step(new Pose[] { new Pose(rightReachCursor.p0, rCon.aim.orientation), new Pose(leftReachCursor.p0, lCon.aim.orientation) }, 1);
|
||||
if (rCon.stick.y > 0.1f || lCon.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 {
|
||||
net.me.cursor0 = rightCursor.p0; net.me.cursor1 = rightCursor.p0; net.me.cursor2 = leftCursor.p0; net.me.cursor3 = leftCursor.p0;
|
||||
net.me.cursor0 = rightReachCursor.p0; net.me.cursor1 = rightReachCursor.p0; net.me.cursor2 = leftReachCursor.p0; net.me.cursor3 = leftReachCursor.p0;
|
||||
}
|
||||
|
||||
// throw yourself (delta -> vel -> momentum)
|
||||
|
@ -232,49 +252,46 @@ public class Monolith {
|
|||
// Vec3 fullstick = subCon.aim.orientation * rot * dir;
|
||||
// pos += fullstick * subCon.trigger * Time.Elapsedf;
|
||||
|
||||
|
||||
|
||||
|
||||
// DRAG DRIFT
|
||||
Vec3 rPos = net.me.cursor0;
|
||||
// if (domCon.grip) {
|
||||
// // movePress = Time.Totalf;
|
||||
// domDragStart = domPos;
|
||||
// }
|
||||
// vel += -(domPos - domDragStart) * 24 * domCon.grip;
|
||||
// domDragStart = domPos;
|
||||
|
||||
Vec3 lPos = net.me.cursor3;
|
||||
// if (subCon.grip) {
|
||||
// // movePress = Time.Totalf;
|
||||
// subDragStart = subPos;
|
||||
// }
|
||||
// if (subCon.IsX1Pressed) {
|
||||
// }
|
||||
// vel += -(subPos - subDragStart) * 24 * subCon.grip;
|
||||
// subDragStart = subPos;
|
||||
if (rCon.grip > 0.5f) {
|
||||
if (!rightGripping) {
|
||||
gripPos = rPos;
|
||||
gripLeft = false;
|
||||
rightGripping = true;
|
||||
}
|
||||
} else {
|
||||
rightGripping = false;
|
||||
}
|
||||
|
||||
if (lCon.grip > 0.5f) {
|
||||
if (!leftGripping) {
|
||||
gripPos = lPos;
|
||||
gripLeft = true;
|
||||
leftGripping = true;
|
||||
}
|
||||
} else {
|
||||
leftGripping = false;
|
||||
}
|
||||
// use grip grab reach cursor origin it then becoming a backhanded stretch cursor
|
||||
// if (rCon.grip > 0.5f) {
|
||||
// if (!rightGripping) {
|
||||
// gripPos = rPos;
|
||||
// gripLeft = false;
|
||||
// rightGripping = true;
|
||||
// }
|
||||
// } else {
|
||||
// rightGripping = false;
|
||||
// }
|
||||
|
||||
// if (lCon.grip > 0.5f) {
|
||||
// if (!leftGripping) {
|
||||
// gripPos = lPos;
|
||||
// gripLeft = true;
|
||||
// leftGripping = true;
|
||||
// }
|
||||
// } else {
|
||||
// leftGripping = false;
|
||||
// }
|
||||
|
||||
// if (rightGripping || leftGripping) {
|
||||
// Vec3 gripTo = gripLeft ? lPos : rPos;
|
||||
// pos = -(gripTo - Input.Head.position) + gripPos - (Input.Head.position - pos);
|
||||
// vel = Vec3.Zero;
|
||||
// }
|
||||
// delete: gripPos, gripLeft, rightGripping, leftGripping
|
||||
// gripPos = r/l OldPos
|
||||
// rightGripping/leftGripping -> state machine (world grip, stretch, backhanded, grinding?)
|
||||
|
||||
|
||||
|
||||
|
||||
if (rightGripping || leftGripping) {
|
||||
Vec3 gripTo = gripLeft ? lPos : rPos;
|
||||
pos = -(gripTo - Input.Head.position) + gripPos - (Input.Head.position - pos);
|
||||
vel = Vec3.Zero;
|
||||
}
|
||||
|
||||
// CUBIC BEZIER RAIL
|
||||
// Vec3[] rail = new Vec3[] {
|
||||
|
|
10
app/Oriel.cs
10
app/Oriel.cs
|
@ -69,9 +69,15 @@ public class Oriel {
|
|||
data.time = (float)Time.Total;
|
||||
buffer.Set(data);
|
||||
|
||||
Matrix matrix = Matrix.TR(bounds.center + Vec3.Up * (float)Math.Sin(Time.Elapsedf), Quat.FromAngles(0, Time.Elapsedf * 60, 0)).Inverse;
|
||||
Matrix matrix = Matrix.TR(
|
||||
bounds.center,
|
||||
Quat.FromAngles(0, Time.Totalf * 12, 0).Normalized
|
||||
).Inverse;
|
||||
// matrix. = (float)Math.Sin(Time.Elapsedf);
|
||||
mat.SetMatrix("_matrix", matrix);
|
||||
|
||||
mat["_matrix"] = (Matrix)System.Numerics.Matrix4x4.Transpose(matrix);
|
||||
|
||||
// mat.SetMatrix("_matrix", matrix);
|
||||
|
||||
// circle around center
|
||||
// bounds.center = Quat.FromAngles(0, 0, Time.Totalf * 60) * Vec3.Up * 0.3f;
|
||||
|
|
|
@ -41,7 +41,7 @@ public class ReachCursor : SpatialCursor {
|
|||
this.max = 10f;
|
||||
}
|
||||
Vec3 pos;
|
||||
Vec3 origin;
|
||||
public Vec3 origin;
|
||||
public override void Step(Pose[] poses, float scalar) {
|
||||
pos = poses[0].position;
|
||||
Vec3 wrist = mono.Wrist(chirality).position;
|
||||
|
|
Loading…
Add table
Reference in a new issue