-
-
Notifications
You must be signed in to change notification settings - Fork 197
Allow partial/separate resets for feet and fingers #1441
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
fun isThigh(trackerPosition: TrackerPosition?): Boolean { | ||
trackerPosition?.let { | ||
return it == TrackerPosition.LEFT_UPPER_LEG || | ||
it == TrackerPosition.RIGHT_UPPER_LEG | ||
} | ||
return false | ||
} | ||
|
||
fun isLeftArm(trackerPosition: TrackerPosition?): Boolean { | ||
trackerPosition?.let { | ||
return it == TrackerPosition.LEFT_SHOULDER || | ||
it == TrackerPosition.LEFT_UPPER_ARM || | ||
it == TrackerPosition.LEFT_LOWER_ARM || | ||
it == TrackerPosition.LEFT_HAND | ||
} | ||
return false | ||
} | ||
|
||
fun isRightArm(trackerPosition: TrackerPosition?): Boolean { | ||
trackerPosition?.let { | ||
return it == TrackerPosition.RIGHT_SHOULDER || | ||
it == TrackerPosition.RIGHT_UPPER_ARM || | ||
it == TrackerPosition.RIGHT_LOWER_ARM || | ||
it == TrackerPosition.RIGHT_HAND | ||
} | ||
return false | ||
} | ||
|
||
fun isLeftLowerArm(trackerPosition: TrackerPosition?): Boolean { | ||
trackerPosition?.let { | ||
return it == TrackerPosition.LEFT_LOWER_ARM || | ||
it == TrackerPosition.LEFT_HAND | ||
} | ||
return false | ||
} | ||
|
||
fun isRightLowerArm(trackerPosition: TrackerPosition?): Boolean { | ||
trackerPosition?.let { | ||
return it == TrackerPosition.RIGHT_LOWER_ARM || | ||
it == TrackerPosition.RIGHT_HAND | ||
} | ||
return false | ||
} | ||
|
||
fun isFoot(trackerPosition: TrackerPosition?): Boolean { | ||
trackerPosition?.let { | ||
return it == TrackerPosition.LEFT_FOOT || | ||
it == TrackerPosition.RIGHT_FOOT | ||
} | ||
return false | ||
} | ||
|
||
fun isLeftFinger(trackerPosition: TrackerPosition?): Boolean { | ||
trackerPosition?.let { | ||
return it == TrackerPosition.LEFT_THUMB_METACARPAL || | ||
it == TrackerPosition.LEFT_THUMB_PROXIMAL || | ||
it == TrackerPosition.LEFT_THUMB_DISTAL || | ||
it == TrackerPosition.LEFT_INDEX_PROXIMAL || | ||
it == TrackerPosition.LEFT_INDEX_INTERMEDIATE || | ||
it == TrackerPosition.LEFT_INDEX_DISTAL || | ||
it == TrackerPosition.LEFT_MIDDLE_PROXIMAL || | ||
it == TrackerPosition.LEFT_MIDDLE_INTERMEDIATE || | ||
it == TrackerPosition.LEFT_MIDDLE_DISTAL || | ||
it == TrackerPosition.LEFT_RING_PROXIMAL || | ||
it == TrackerPosition.LEFT_RING_INTERMEDIATE || | ||
it == TrackerPosition.LEFT_RING_DISTAL || | ||
it == TrackerPosition.LEFT_LITTLE_PROXIMAL || | ||
it == TrackerPosition.LEFT_LITTLE_INTERMEDIATE || | ||
it == TrackerPosition.LEFT_LITTLE_DISTAL | ||
} | ||
return false | ||
} | ||
|
||
fun isRightFinger(trackerPosition: TrackerPosition?): Boolean { | ||
trackerPosition?.let { | ||
return it == TrackerPosition.RIGHT_THUMB_METACARPAL || | ||
it == TrackerPosition.RIGHT_THUMB_PROXIMAL || | ||
it == TrackerPosition.RIGHT_THUMB_DISTAL || | ||
it == TrackerPosition.RIGHT_INDEX_PROXIMAL || | ||
it == TrackerPosition.RIGHT_INDEX_INTERMEDIATE || | ||
it == TrackerPosition.RIGHT_INDEX_DISTAL || | ||
it == TrackerPosition.RIGHT_MIDDLE_PROXIMAL || | ||
it == TrackerPosition.RIGHT_MIDDLE_INTERMEDIATE || | ||
it == TrackerPosition.RIGHT_MIDDLE_DISTAL || | ||
it == TrackerPosition.RIGHT_RING_PROXIMAL || | ||
it == TrackerPosition.RIGHT_RING_INTERMEDIATE || | ||
it == TrackerPosition.RIGHT_RING_DISTAL || | ||
it == TrackerPosition.RIGHT_LITTLE_PROXIMAL || | ||
it == TrackerPosition.RIGHT_LITTLE_INTERMEDIATE || | ||
it == TrackerPosition.RIGHT_LITTLE_DISTAL | ||
} | ||
return false | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe this should be a member function on the enum?
ofc it wont be usable with null object but it will be much easier to read
TrackerPosition.isLeftArm(tracker.trackerPosition)
// or
tracker.trackerPosition != null &&
(tracker.trackerPosition.isLeftArm() || tracker.trackerPosition.isLeftFinger())
or if you dont want to check for null, just make it an extension function
fun TrackerPosition?.isLeftArm(): boolean {
this?.let {
return true
}
return false
}
tracker.trackerPosition.isLeftArm()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done with extension functions in 2a6870e
This adds an array on every reset used to specify which trackers should be reset.
If the array is empty, the server will decide which trackers will be reset (all except fingers and feet during mounting basically).
This deprecates the feet reset feature since I believe it is much better to keep it a separate mounting reset.
This is also backwards compatible.
Needs SlimeVR/SolarXR-Protocol#173