|
Post by fabian on Dec 21, 2017 21:39:31 GMT
Hey there,
I was wondering if it was possible to have adjustable air control instead of a just a on/off toggle. This could for example allow the player to jump and adjust his direction slightly mid air, but not spinning around 20 times before landing, like it is when air control is enabled.
|
|
|
Post by fabian on Dec 27, 2017 13:06:18 GMT
Has anyone an idea about this?
|
|
|
Post by sjmtech on Dec 28, 2017 13:02:45 GMT
Hi fabian, you can take a look in vThirdPersonMotor.cs and around the line 470. You can duplicate the if statement if(isGrounded || (!isGrounded && humpAirControl){ // invector rotation code } and assign one as if(isGrounded){ // invector rotation code } and the secon one as if(!isGrounded && jumpAirControl){ // invector rotation code } In this way you can add different speed for each condition. For example you can add in the transform.rotation= ...: freeSpeed.rotationSpeed*0.1f
to reduce by 10 time the speed of the rotation when jumping. It is just a quick hack ... i think that Invector at some point could add an option like "airRotationSpeed" to handle this behaviour!
|
|
|
Post by sjmtech on Dec 28, 2017 19:41:09 GMT
More compact and less ugly version: replace line 475 with:
float dirRotationSpeed=isGrounded ? freeSpeed.rotationSpeed : airRotationSpeed; transform.rotation = Quaternion.Lerp(transform.rotation, Quaternion.Euler(euler), dirRotationSpeed * Time.deltaTime); and after line 71 add:
[vHideInInspector("jumpAirControl")] [Tooltip("Air control rotation speed")] public float airRotationSpeed = 5f; Now in the Jump Table you can set the Air rotation speed. Let me know. Max
|
|
|
Post by fabian on Dec 29, 2017 13:19:02 GMT
More compact and less ugly version: replace line 475 with: float dirRotationSpeed=isGrounded ? freeSpeed.rotationSpeed : airRotationSpeed; transform.rotation = Quaternion.Lerp(transform.rotation, Quaternion.Euler(euler), dirRotationSpeed * Time.deltaTime); and after line 71 add: [vHideInInspector("jumpAirControl")] [Tooltip("Air control rotation speed")] public float airRotationSpeed = 5f; Now in the Jump Table you can set the Air rotation speed. Let me know. Max Thank you, that was exactly what I wanted! I think it would be cool if this was a standard feature with the asset, so maybe the Invector guys can consider?
|
|