- Home /
Remove inertia/momentum from fps controller
I am creating a 2d side scrolling platformer using the FPS controller which I am quite pleased with so far. My only issue is that the fps controller has momentum/inertia which moves the contorller after the key is released. How do I adjust that movement? I would like to tighten the controls.
Thanks in advance!
Answer by robertbu · Oct 17, 2013 at 10:12 PM
I've answered a similar question before. I don't have time to run a test, but I believe this is way the fix went:
Modify the FPS Input Controller so that when the GetAxis() calls for both "Horizontal" and "Vertical" are zero, you call CharacterMotor.SetVelocity() with Vector3.zero;
SetVelocity() in the Character Motor script does a SendMessage(). You either have to a) comment this line out, 2) provide an OnExternalVelocity() function to receive this message, or 3) Modify the SendMessage() so that it doesn't require a receiver.
You may also have to change the GetAxis() calls to GetAxisRaw() calls in the FPS Input Controller script..
Answer by simonindelicate · Nov 12, 2014 at 07:13 AM
Just for anyone else who find this topic using the same googling as me, I was having a problem with controlling the amount of 'momentum'/'inertia' with a rotation that was controlled by getAxis("horizontal") - my solution, eventually, was to adjust the 'gravity' setting for the axis in the input settings. This controls the speed at which the value of a released input returns to zero - so if you want a character to come to an abrupt halt, as I did, then setting it high gives the right result.
Not a solution for everyone - but was for me, and may well have been for the above :)