handed arrays of input data
This commit is contained in:
parent
9d97b091e7
commit
0b5e6ee9da
2 changed files with 27 additions and 21 deletions
|
@ -293,7 +293,6 @@ static class Arts
|
||||||
Color.White
|
Color.White
|
||||||
);
|
);
|
||||||
VFX.Play(min_hit_pos);
|
VFX.Play(min_hit_pos);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
43
src/Rig.cs
43
src/Rig.cs
|
@ -7,10 +7,19 @@ static class Rig
|
||||||
public static Pose head = Pose.Identity;
|
public static Pose head = Pose.Identity;
|
||||||
|
|
||||||
public static DeltaBool btn_select = new(false);
|
public static DeltaBool btn_select = new(false);
|
||||||
public static DeltaBool btn_grip = new(false);
|
|
||||||
public static DeltaBool btn_back = new(false);
|
public static DeltaBool btn_back = new(false);
|
||||||
|
|
||||||
public static Pose l_hld, l_aim, r_hld, r_aim;
|
public static DeltaBool[] btn_grip;
|
||||||
|
public static DeltaBool l_btn_grip => btn_grip[(int)Handed.Left];
|
||||||
|
public static DeltaBool r_btn_grip => btn_grip[(int)Handed.Right];
|
||||||
|
|
||||||
|
public static Pose[] pose_hld;
|
||||||
|
public static Pose l_hld => pose_hld[(int)Handed.Left];
|
||||||
|
public static Pose r_hld => pose_hld[(int)Handed.Right];
|
||||||
|
|
||||||
|
public static Pose[] pose_aim;
|
||||||
|
public static Pose l_aim => pose_aim[(int)Handed.Left];
|
||||||
|
public static Pose r_aim => pose_aim[(int)Handed.Right];
|
||||||
|
|
||||||
public static Vec3 fullstick = Vec3.Up;
|
public static Vec3 fullstick = Vec3.Up;
|
||||||
public static Pose r_con_stick = Pose.Identity;
|
public static Pose r_con_stick = Pose.Identity;
|
||||||
|
@ -19,7 +28,9 @@ static class Rig
|
||||||
|
|
||||||
public static void Init()
|
public static void Init()
|
||||||
{
|
{
|
||||||
|
btn_grip = new DeltaBool[] { new(false), new(false) };
|
||||||
|
pose_hld = new Pose[] { new(), new() };
|
||||||
|
pose_aim = new Pose[] { new(), new() };
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Frame()
|
public static void Frame()
|
||||||
|
@ -32,11 +43,11 @@ static class Rig
|
||||||
btn_select.Step(Input.Key(Key.MouseLeft).IsActive());
|
btn_select.Step(Input.Key(Key.MouseLeft).IsActive());
|
||||||
btn_back.Step(Input.Key(Key.MouseRight).IsActive());
|
btn_back.Step(Input.Key(Key.MouseRight).IsActive());
|
||||||
|
|
||||||
r_hld = new Pose(
|
pose_hld[(int)Handed.Right] = new Pose(
|
||||||
V.XYZ(SKMath.Sin(Time.Totalf * 6f) * 0.6f * 0.0f, 0.5f, 1.0f),
|
V.XYZ(SKMath.Sin(Time.Totalf * 6f) * 0.6f * 0.0f, 0.5f, 1.0f),
|
||||||
Quat.FromAngles(0, 0, 45) * Quat.FromAngles(0, SKMath.Sin(Time.Totalf * 6f) * 60f, 0)
|
Quat.FromAngles(0, 0, 45) * Quat.FromAngles(0, SKMath.Sin(Time.Totalf * 6f) * 60f, 0)
|
||||||
);
|
);
|
||||||
l_aim = new Pose(
|
pose_aim[(int)Handed.Left] = new Pose(
|
||||||
V.XYZ(1.0f, 0.5f, 0.5f), // V.XYZ(SKMath.Sin(Time.Totalf * 2f) * 0.6f, 0.5f, 0.5f),
|
V.XYZ(1.0f, 0.5f, 0.5f), // V.XYZ(SKMath.Sin(Time.Totalf * 2f) * 0.6f, 0.5f, 0.5f),
|
||||||
Quat.Identity
|
Quat.Identity
|
||||||
);
|
);
|
||||||
|
@ -51,24 +62,20 @@ static class Rig
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Hand r_hand = Input.Hand(Handed.Right);
|
|
||||||
// [!] hand input simulates controller...
|
|
||||||
Controller r_con = Input.Controller(Handed.Right);
|
|
||||||
r_hld = r_con.pose;
|
|
||||||
r_aim = r_con.aim;
|
|
||||||
|
|
||||||
Controller l_con = Input.Controller(Handed.Left);
|
Controller l_con = Input.Controller(Handed.Left);
|
||||||
l_hld = l_con.pose;
|
btn_grip[(int)Handed.Left].Step(l_con.grip > 0.5f);
|
||||||
l_aim = l_con.aim;
|
pose_hld[(int)Handed.Left] = l_con.pose;
|
||||||
|
pose_aim[(int)Handed.Left] = l_con.aim;
|
||||||
|
|
||||||
|
Controller r_con = Input.Controller(Handed.Right);
|
||||||
|
btn_grip[(int)Handed.Right].Step(r_con.grip > 0.5f);
|
||||||
|
pose_hld[(int)Handed.Right] = r_con.pose;
|
||||||
|
pose_aim[(int)Handed.Right] = r_con.aim;
|
||||||
|
|
||||||
bool con_tracked = r_con.trackedPos > TrackState.Lost;
|
|
||||||
// bool hand_tracked = Input.HandSource(Handed.Right) > HandSource.None;
|
|
||||||
if (con_tracked)
|
|
||||||
{
|
|
||||||
btn_select.Step(r_con.x1.IsActive() || r_con.trigger > 0.5f);
|
btn_select.Step(r_con.x1.IsActive() || r_con.trigger > 0.5f);
|
||||||
btn_grip.Step(r_con.grip > 0.5f);
|
|
||||||
btn_back.Step(r_con.x2.IsActive());
|
btn_back.Step(r_con.x2.IsActive());
|
||||||
|
|
||||||
|
|
||||||
Vec2 stick = r_con.stick;
|
Vec2 stick = r_con.stick;
|
||||||
Quat stick_rot = Quat.FromAngles(stick.y * -90, 0, stick.x * +90);
|
Quat stick_rot = Quat.FromAngles(stick.y * -90, 0, stick.x * +90);
|
||||||
float stick_sign = r_con.IsStickClicked ? -1 : +1;
|
float stick_sign = r_con.IsStickClicked ? -1 : +1;
|
||||||
|
|
Loading…
Add table
Reference in a new issue