Hello. I am currently using the FPSWalkerEnhanced Script found here. It has air control, but it stops and moves on a dime. I wanted to add momentum to it, e.g it takes a second to slow down and move the other direction, because I will be using a jetpack in my game. I modified the air control section to the code below.It works great when I am facing straight forward. My problem is that if i change the rotation of my character, it goes crazy, spinning is circles and jerking around. How do I include the rotation in this, so that it will work which ever way I am looking? Any help would be greatly appreciated.
The code did not turn out right on here. It looks better on Unity forum.
if(airControl){ if (Input.GetAxis("Horizontal") > 0){ if(moveDirection.x < 25){ moveDirection.x +=(inputX * inputModifyFactor * airAcc * Time.deltaTime ); moveDirection = myTransform.TransformDirection(moveDirection); } } if (Input.GetAxis("Horizontal") < 0){ if(moveDirection.x > -25){ moveDirection.x +=(inputX * inputModifyFactor * airAcc * Time.deltaTime ); moveDirection = myTransform.TransformDirection(moveDirection); } } else if (Input.GetAxis("Horizontal") == 0){ if(moveDirection.x > 0){ moveDirection.x -= (airDecc *Time.deltaTime); } if(moveDirection.x < 0){ moveDirection.x += (airDecc *Time.deltaTime); } } if (Input.GetAxis("Vertical") > 0){ if(moveDirection.z < 25){ moveDirection.z +=(inputY * inputModifyFactor * airAcc * Time.deltaTime ); moveDirection = myTransform.TransformDirection(moveDirection); } } if (Input.GetAxis("Vertical") < 0){ if(moveDirection.z > -25){ moveDirection.z +=(inputY * inputModifyFactor * airAcc * Time.deltaTime ); moveDirection = myTransform.TransformDirection(moveDirection); } } else if (Input.GetAxis("Vertical") == 0){ if(moveDirection.z > 0){ moveDirection.z -= (airDecc *Time.deltaTime); } if(moveDirection.z < 0){ moveDirection.z += (airDecc *Time.deltaTime); } } }