- Home /
Need to restrict "air control" 2D platformer.
So I have a problem, it's probably a noob one but here goes. I am trying to dial in my 2d platformer controller the way I want it. I want to prevent the player from controlling their direction while in air (grounded bool set to false). That way the player will have to try and judge distance and plan a jump ahead of time ( until they get access to a jetpack of sorts with limited fuel). I know that I can just place "if (grounded){" but when I do that the player doesn't maintain the momentum in the direction they were moving before they left the ground. Oh by the way this is a physics based controller, as you could probably tell anyway.
Answer by tebandesade · May 06, 2015 at 09:44 PM
Hi! Maybe the problem when your if(grounded) is that you're moving the player respect to local space, while you have to move it respect to world space or vice-versa depends. Also, here's a question that wanted to do the opposite with a script that it appeared to do what you want. http://forum.unity3d.com/threads/charactercontroller-move-in-air-control.99595/
Your answer
Follow this Question
Related Questions
2D 360 degress platformer example needed 0 Answers
Cannot set motor speed in script 1 Answer
Object jumps right after the attached HingeJoint2D is Enabled 0 Answers
Question on 2d planet gravity 1 Answer
Coroutine not working properly 1 Answer