All in all, I feel analog sensitivity for controllers should be less. It should be even less when moving at slow speeds. An idea is to have turn sensitivity be dynamic with player speed. I also found my self having to wrestle with the free cam.
Also, found a piece of code that can potentially break things in the slope detection script:
transform.rotation = Quaternion.FromToRotation(Vector3.up, GroundNormal);
I was doing slope detection in Unity too, and you have to be careful about what's going on. By asking from Vector3.up to ground normal, your code will break at a slope of exactly 180 around the forward axis, or at least when you can't specify which way the angle calculation goes. I emphasize this because you likely can't replicate this with a model import from Blender. Floating point precision and all makes it so 90 degrees in Blender is something along the lines of 89.99999. I haven't tested this out in HedgePhysics, but came into a similar issue in another project:
You're asking Unity to take 2 Vector3s and calculate the angle between them. Thing is, say we have a Vector direction of (0,0,1) and our current Vector direction is (0,0,0). How would we rotate between them? You can't specify whether you just want to turn around or do a back flip on your head. Whenever something like this happens, Unity will wrestle with the 2 results and basically just break Slope detection at that point. This part is just me spit-balling but this can also explain why Blitz Sonic has a similar bug at certain angles.
What I'd say would be a fix for this is something along the lines of:
transform.rotation = Quaternion.FromToRotation(transform.up, GroundNormal) * transform.rotation;
Anyway, what this does is take your current slope direction and compares it with the ground normal direction and gets the rotation between them. It then takes your current transform.rotation and applies that on top. A couple of things to clarify:
Because of how Quaternions work, we can "multiply" them by a Vector3. At first glance a Quaternion might just be a fanciful Vector4, but it breaks the rules a bit. What it does is transform the Quaternion to a 3x3 matrix using Quaternion math and the transform.rotation into a 3x1 matrix and multiply, which really means to rotate it by this. Something to also note is how Quaternion multiplication is non-commutative, so keep track of multiplication order!
All in all, nice job LakeFepard, HedgePhysics is really looking good.
EDIT: Cleared up clarification a bit and grammar. Sorry mods for the amount of edits I do on my posts :V
This post has been edited by Amnimator: 01 May 2017 - 12:40 PM