Compare commits
5 commits
a96a6fbacd
...
2d7f92e5a0
Author | SHA1 | Date | |
---|---|---|---|
2d7f92e5a0 | |||
81def53f8c | |||
61d911a9e6 | |||
55c88406f7 | |||
32db73a0f4 |
6 changed files with 176 additions and 62 deletions
|
@ -2,8 +2,8 @@
|
|||
<manifest
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.dofdev.snake"
|
||||
android:versionCode="48"
|
||||
android:versionName="1.53"
|
||||
android:versionCode="51"
|
||||
android:versionName="1.56"
|
||||
android:installLocation="auto"
|
||||
>
|
||||
<uses-sdk android:minSdkVersion="29" android:targetSdkVersion="32" />
|
||||
|
@ -17,25 +17,43 @@
|
|||
<!-- <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" /> -->
|
||||
|
||||
<!-- Generic OpenXR items -->
|
||||
<uses-feature android:name="android.hardware.vr.headtracking" android:required="true" android:version="1" />
|
||||
<uses-feature
|
||||
android:name="android.hardware.vr.headtracking"
|
||||
android:required="true"
|
||||
android:version="1"
|
||||
/>
|
||||
<uses-permission android:name="org.khronos.openxr.permission.OPENXR_SYSTEM" />
|
||||
<uses-permission android:name="org.khronos.openxr.permission.OPENXR" />
|
||||
<queries>
|
||||
<provider android:authorities="org.khronos.openxr.runtime_broker;org.khronos.openxr.system_runtime_broker" />
|
||||
<intent> <action android:name="org.khronos.openxr.OpenXRRuntimeService" /> </intent>
|
||||
<intent> <action android:name="org.khronos.openxr.OpenXRApiLayerService" /> </intent>
|
||||
<provider
|
||||
android:authorities="org.khronos.openxr.runtime_broker;org.khronos.openxr.system_runtime_broker"
|
||||
/>
|
||||
<intent> <action
|
||||
android:name="org.khronos.openxr.OpenXRRuntimeService"
|
||||
/> </intent>
|
||||
<intent> <action
|
||||
android:name="org.khronos.openxr.OpenXRApiLayerService"
|
||||
/> </intent>
|
||||
</queries>
|
||||
|
||||
<!-- Vive specific items -->
|
||||
<uses-feature android:name="wave.feature.handtracking" android:required="false" />
|
||||
<uses-feature
|
||||
android:name="wave.feature.handtracking"
|
||||
android:required="false"
|
||||
/>
|
||||
<uses-feature android:name="wave.feature.tracker" android:required="false" />
|
||||
|
||||
<!-- Snapdragon specific items -->
|
||||
<uses-permission android:name="com.qualcomm.qti.qxr.QXRServiceClientPermission" android:required="false" />
|
||||
<uses-permission
|
||||
android:name="com.qualcomm.qti.qxr.QXRServiceClientPermission"
|
||||
android:required="false"
|
||||
/>
|
||||
<queries>
|
||||
<package android:name="com.qualcomm.qti.spaces.services" />
|
||||
<package android:name="com.qualcomm.qti.openxrruntime" />
|
||||
<intent> <action android:name="com.qualcomm.qti.openxr.spaces.intent.action.BIND" /> </intent>
|
||||
<intent> <action
|
||||
android:name="com.qualcomm.qti.openxr.spaces.intent.action.BIND"
|
||||
/> </intent>
|
||||
</queries>
|
||||
|
||||
<!-- Oculus specific items -->
|
||||
|
@ -45,11 +63,26 @@
|
|||
<uses-permission android:name="com.oculus.permission.EYE_TRACKING" />
|
||||
<uses-permission android:name="com.oculus.permission.USE_ANCHOR_API" />
|
||||
<uses-permission android:name="com.oculus.permission.USE_SCENE" />
|
||||
<uses-feature android:name="com.oculus.feature.PASSTHROUGH" android:required="true" />
|
||||
<uses-feature android:name="oculus.software.handtracking" android:required="false" />
|
||||
<uses-feature android:name="com.oculus.software.body_tracking" android:required="false" />
|
||||
<uses-feature android:name="oculus.software.face_tracking" android:required="false" />
|
||||
<uses-feature android:name="oculus.software.eye_tracking" android:required="false" />
|
||||
<uses-feature
|
||||
android:name="com.oculus.feature.PASSTHROUGH"
|
||||
android:required="true"
|
||||
/>
|
||||
<uses-feature
|
||||
android:name="oculus.software.handtracking"
|
||||
android:required="false"
|
||||
/>
|
||||
<uses-feature
|
||||
android:name="com.oculus.software.body_tracking"
|
||||
android:required="false"
|
||||
/>
|
||||
<uses-feature
|
||||
android:name="oculus.software.face_tracking"
|
||||
android:required="false"
|
||||
/>
|
||||
<uses-feature
|
||||
android:name="oculus.software.eye_tracking"
|
||||
android:required="false"
|
||||
/>
|
||||
|
||||
<application
|
||||
android:allowBackup="false"
|
||||
|
@ -59,11 +92,23 @@
|
|||
android:supportsRtl="true"
|
||||
>
|
||||
<!-- Oculus -->
|
||||
<meta-data android:name="com.oculus.supportedDevices" android:value="quest2|quest3|questpro" />
|
||||
<meta-data android:name="com.oculus.handtracking.version" android:value="V2.0" />
|
||||
<meta-data android:name="com.oculus.ossplash.background" android:value="passthrough-contextual" />
|
||||
<meta-data
|
||||
android:name="com.oculus.supportedDevices"
|
||||
android:value="quest2|quest3|questpro"
|
||||
/>
|
||||
<meta-data
|
||||
android:name="com.oculus.handtracking.version"
|
||||
android:value="V2.0"
|
||||
/>
|
||||
<meta-data
|
||||
android:name="com.oculus.ossplash.background"
|
||||
android:value="passthrough-contextual"
|
||||
/>
|
||||
<meta-data android:name="com.oculus.vr.focusaware" android:value="true" />
|
||||
<uses-native-library android:name="libopenxr_forwardloader.oculus.so" android:required="false" />
|
||||
<uses-native-library
|
||||
android:name="libopenxr_forwardloader.oculus.so"
|
||||
android:required="false"
|
||||
/>
|
||||
<!-- Pico -->
|
||||
<meta-data android:name="pvr.app.type" android:value="vr" />
|
||||
<meta-data android:name="handtracking" android:value="1" />
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
- [lynx r1 resource](https://github.com/technobaboo/stereokit_lynx_dotnet_template)
|
||||
- [fb passthrough resource](https://www.aesiio.com/blog/passthrough-dot-net-core)
|
||||
- [fb passthrough tool source](https://github.com/StereoKit/StereoKit/blob/master/Examples/StereoKitTest/Tools/PassthroughFBExt.cs)
|
||||
|
||||
|
@ -55,12 +54,12 @@ todo
|
|||
|
||||
benchmark
|
||||
need to be able to play without moving/turning the box
|
||||
DepthTest Material.DepthTest { get; set; }
|
||||
you could use DepthTest.Greater to draw a glow that indicates an object is behind something.
|
||||
|
||||
start music on egg eat
|
||||
to keep prior tutorial phase focused and a strong indication that auto move has kicked in
|
||||
|
||||
curved hanger
|
||||
|
||||
my tempo (zen mode *after initial release*)
|
||||
on l_con tap (a) btn to step, and repeatedly to set tempo
|
||||
once a tempo has been set you can stop tapping and you'll coast at that tempo
|
||||
|
|
64
src/Arts.cs
64
src/Arts.cs
|
@ -84,22 +84,66 @@ static class Arts
|
|||
box_scale
|
||||
);
|
||||
|
||||
// hanger
|
||||
// telescoping hanging rod
|
||||
if (Mono.in_cone.state && Mono.box_mode == Mono.BoxMode.Hold || Mono.box_mode == Mono.BoxMode.Mount)
|
||||
{
|
||||
float box_head_dist = Vec3.Distance(box_pos, Rig.head.position);
|
||||
Lines.Add(
|
||||
box_m4 * V.XYZ(0, Mono.SD_Y - 0.5f, 0),
|
||||
Rig.head.position + Rig.head.orientation * V.XYZ(0, 6 * U.cm, -box_head_dist),
|
||||
Color.Hex(0x808080FF).ToLinear(),
|
||||
1.0f * U.mm
|
||||
|
||||
Vec3 box_mount = box_m4 * V.XYZ(0, Mono.SD_Y - 0.5f, 0);
|
||||
Vec3 box_handl = Rig.head.position + Rig.head.orientation * V.XYZ(0, 6 * U.cm, -box_head_dist);
|
||||
|
||||
Vec3 head_mount = Rig.head.position + Rig.head.orientation * V.XYZ(0, 6 * U.cm, 0);
|
||||
Vec3 head_handl = Vec3.Lerp(box_handl, head_mount, 0.5f);
|
||||
Vec3[] p = new Vec3[] {
|
||||
box_mount,
|
||||
box_handl,
|
||||
|
||||
head_handl,
|
||||
head_mount,
|
||||
};
|
||||
|
||||
// debug bezier points
|
||||
// for (int i = 0; i < p.Length; i++)
|
||||
// {
|
||||
// Mesh.Sphere.Draw(
|
||||
// mat_justcolor,
|
||||
// Matrix.TS(
|
||||
// p[i],
|
||||
// 2 * U.mm
|
||||
// ),
|
||||
// Color.White
|
||||
// );
|
||||
// }
|
||||
|
||||
Mesh.Sphere.Draw(
|
||||
mat_justcolor,
|
||||
Matrix.TS(
|
||||
box_mount,
|
||||
3 * U.mm
|
||||
),
|
||||
Color.Hex(0x959493FF).ToLinear()
|
||||
);
|
||||
|
||||
int steps = 64;
|
||||
Vec3 pastPos = p[0];
|
||||
float pastThc = 0.0f;
|
||||
for (int i = 0; i < steps; i++)
|
||||
{
|
||||
float t = (float)i / (steps - 1);
|
||||
Vec3 a = Vec3.Lerp(p[0], p[1], t);
|
||||
Vec3 b = Vec3.Lerp(p[1], p[2], t);
|
||||
Vec3 c = Vec3.Lerp(p[2], p[3], t);
|
||||
Vec3 pos = Vec3.Lerp(Vec3.Lerp(a, b, t), Vec3.Lerp(b, c, t), t);
|
||||
float thc = (1.0f + Maths.precision(t, 0.333f) * 2.0f) * U.mm;
|
||||
Lines.Add(
|
||||
Rig.head.position + Rig.head.orientation * V.XYZ(0, 6 * U.cm, -box_head_dist),
|
||||
Rig.head.position + Rig.head.orientation * V.XYZ(0, 6 * U.cm, 0),
|
||||
Color.Hex(0x808080FF).ToLinear(),
|
||||
1.0f * U.mm
|
||||
pastPos,
|
||||
pos,
|
||||
thc != pastThc ? Color.Hex(0x959493FF).ToLinear() : Color.Hex(0x808080FF).ToLinear(),
|
||||
thc
|
||||
);
|
||||
pastPos = pos;
|
||||
pastThc = thc;
|
||||
}
|
||||
}
|
||||
|
||||
// box contents
|
||||
|
|
10
src/Maths.cs
10
src/Maths.cs
|
@ -35,7 +35,10 @@ public static class Maths
|
|||
// public static int roundi(float value) => MathF.Round(value)
|
||||
|
||||
public static float precision(float x, float p)
|
||||
=> round(x * p) / p;
|
||||
{
|
||||
float ps = p < 1.0f ? 1 / p : p;
|
||||
return round(x * ps) / ps;
|
||||
}
|
||||
|
||||
public static float smooth_start(float t) => (t * t * t);
|
||||
public static float smooth_stop(float t)
|
||||
|
@ -43,6 +46,11 @@ public static class Maths
|
|||
float s = sign(t);
|
||||
return (s - ((s - t) * (s - t) * (s - t)));
|
||||
}
|
||||
public static float less_smooth_stop(float t) // [!] messy implementation
|
||||
{
|
||||
float s = sign(t);
|
||||
return (s - ((s - t) * (s - t)));
|
||||
}
|
||||
|
||||
public static float lerp(float a, float b, float t) => a + (b - a) * t;
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ static class Mono
|
|||
public static bool menu = true;
|
||||
|
||||
public static Pose box_pose = new(0, -3 * U.cm, -10 * U.cm);
|
||||
public static float box_dist = 32 * U.cm;
|
||||
public static float box_dist = 42 * U.cm;
|
||||
public static float box_scale = 1.333f * U.cm;
|
||||
public const int SD_X = 3, SD_Y = 2, SD_Z = 3;
|
||||
public static SpatialArray<int>
|
||||
|
|
36
src/Rig.cs
36
src/Rig.cs
|
@ -40,13 +40,33 @@ static class Rig
|
|||
}
|
||||
else
|
||||
{
|
||||
// Hand r_hand = Input.Hand(Handed.Right);
|
||||
// [!] hand input simulates controller...
|
||||
Controller r_con = Input.Controller(Handed.Right);
|
||||
if (Input.HandSource(Handed.Right) == HandSource.Articulated)
|
||||
{
|
||||
Hand r_hnd = Input.Hand(Handed.Right);
|
||||
if (r_hnd.IsTracked)
|
||||
{
|
||||
btn_select.Step(r_hnd.IsPinched);
|
||||
btn_grip.Step(r_hnd.IsGripped);
|
||||
// btn_back.Step(); // [!] todo
|
||||
|
||||
bool con_tracked = r_con.trackedPos > TrackState.Lost;
|
||||
// bool hand_tracked = Input.HandSource(Handed.Right) > HandSource.None;
|
||||
if (con_tracked)
|
||||
Vec3 thumb_tip = r_hnd.Get(FingerId.Thumb, JointId.Tip).position;
|
||||
Vec3 index_tip = r_hnd.Get(FingerId.Index, JointId.Tip).position;
|
||||
r_con_stick.position = thumb_tip;
|
||||
|
||||
fullstick = Vec3.Direction(index_tip, thumb_tip);
|
||||
|
||||
float ax = Maths.abs(fullstick.x);
|
||||
float ay = Maths.abs(fullstick.y);
|
||||
float az = Maths.abs(fullstick.z);
|
||||
if (ax > ay && ax > az) new_dir = new(Maths.sign(fullstick.x), 0, 0);
|
||||
if (ay > ax && ay > az) new_dir = new(0, Maths.sign(fullstick.y), 0);
|
||||
if (az > ax && az > ay) new_dir = new(0, 0, Maths.sign(fullstick.z));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Controller r_con = Input.Controller(Handed.Right);
|
||||
if (r_con.IsTracked)
|
||||
{
|
||||
btn_select.Step(r_con.x1.IsActive() || r_con.trigger > 0.5f);
|
||||
btn_grip.Step(r_con.grip > 0.5f);
|
||||
|
@ -56,11 +76,8 @@ static class Rig
|
|||
Quat stick_rot = Quat.FromAngles(stick.y * -90, 0, stick.x * +90);
|
||||
float stick_sign = r_con.IsStickClicked ? -1 : +1;
|
||||
r_con_stick = r_con.aim;
|
||||
// r_con_stick.position += r_con_stick.orientation * V.XYZ(0.0065f, -0.012f, -0.05f);
|
||||
// r_con_stick.orientation *= Quat.FromAngles(-50, 0, 0);
|
||||
fullstick = r_con_stick.orientation * stick_rot * Vec3.Up * stick_sign;
|
||||
|
||||
// Vec3 fullstick = r_hand.palm.orientation * Vec3.Up;
|
||||
float ax = Maths.abs(fullstick.x);
|
||||
float ay = Maths.abs(fullstick.y);
|
||||
float az = Maths.abs(fullstick.z);
|
||||
|
@ -71,3 +88,4 @@ static class Rig
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue