Comments (4)
Hi! Thanks for the great analysis. That is indeed a bug which I simply did not find, probably since I did not allow the shoulders to move backwards. Does removing the "-" sign resolve the issue? I'd be happy to merge a pull request :)
from vrarmik.
Yes I think it would, but I don't have a way to test it. Just saw the issue while I was reading and wanted to make sure to mention it!
If it were me I'd probably rewrite this section to unify the if statements with something along the lines of:
float forwardDistanceRatio = Vector3.Dot(handShoulderOffset, shoulder.transform.forward) / armLength;
float upwardDistanceRatio = Vector3.Dot(handShoulderOffset, shoulder.transform.up) / armLength;
( float distanceRatioThreshold, float shoulderRotationMultiplier ) =
( 0 < forwardDistanceRatio
? ( 0.5f, distinctShoulderRotationMultiplier )
: ( 0.08f, distinctShoulderRotationMultiplier * 10.0f ) );
forwardDistanceRatio =
Mathf.Sign(forwardDistanceRatio) *
Mathf.Max(0.0f, Mathf.Abs(forwardDistanceRatio) - distanceRatioThreshold );
targetAngle.y =
Mathf.Clamp(
forwardDistanceRatio * shoulderRotationMultiplier,
-distinctShoulderRotationLimitBackward, distinctShoulderRotationLimitForward);
But that's more than just a simple bug fix, and I'm not 100% sure if that is correct C# syntax or not!
from vrarmik.
I actually ended up writing this section totally differently in my port. I decided to just scale the distance ratio into [0,1] based on a threshold range for each direction, apply a EaseInOutSine to the resulting alpha to make it feel more organic, and then multiply it by the maximum rotation in whatever direction it's supposed to be going. A bit easier to tune for my purposes.
from vrarmik.
Thanks for your contribution.
I agree that EaseInOut would make it more organic. I hope I will be able to try these changes on a VR headset in the near future and to update the repository. Unfortunately, this project is not actively maintained and I am not developing in VR/Unity anymore.
from vrarmik.
Related Issues (8)
- Custom Scaling HOT 1
- Oculus Hands HOT 1
- Avatar Facing Down HOT 8
- Full body avatar rotations won't rotate shoulders HOT 2
- Hands behind head isn't accurate and causes odd shoulder rotations HOT 1
- Not working with the latest version of Unity XR HOT 2
- SteamVR glove hand replacement not behaving as desired HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vrarmik.