Answers for "Head and body rotate threshold"
http://answers.unity.com/questions/1489206/head-and-body-rotate-threshold.html
The latest answers for the question "Head and body rotate threshold"Answer by Cornelis-de-Jager
http://answers.unity.com/answers/1489229/view.html
Ok so here is my solution. first you need to calculate the max angle you can rotate on. This needs to be dynamic:
void Update () {
maxAngle = CalculateAngle ();
}
float CalculateAngle () {
Vector3 lookDir = head.forward;
Vector3 faceDir = body.forward;
float diff = Mathf.Abs(Vector3.Angle(lookDir, faceDir));
Debug.Log(diff);
// Now write the curve function
float angle = LookCurve (diff) ;
return angle;
}
float LookCurve (float diff) {
// Cats Eye (like in diagram)
return 90 * (1 - Mathf.Pow(diff / 90, 2.5f));
}
The lookCurve function is basically what gives the Shape. For the linear it will simply be a diamond shape lookbox, for your more catlike one it will be the second return function. pick one or make your own. go to google and plug in this formula 'y = 90 * (1-(x/90)^2.5)' it will automaticall create a graph, you can then just tweek it, I suggest tweeking the power.
The next step is to Create a function that simple moves the players head towards the centre if they are out of bounds. You will need to do this yourself. Should be simple though.Tue, 03 Apr 2018 23:26:15 GMTCornelis-de-Jager