T
T
Tempetas2018-10-22 15:20:12
Game development
Tempetas, 2018-10-22 15:20:12

Unity 2d Character does not fall while walking. What to do?

When creating a 2D Runner, I make a character. Jumps, runs, but does not fall down while walking. Tell me, please, what to do?

Answer the question

In order to leave comments, you need to log in

4 answer(s)
G
Griboks, 2018-10-22
@Griboks

We need to add gravity.

H
Hzpriezz, 2018-10-22
@Hzpriezz

Don't forget the colliders, the character needs to know where the ground is.
If it is, then the object has no weight or the gravity parameter is disabled.

M
Mikhail Nikitin, 2018-10-23
@Vilyx

Is the character controlled by the script directly or through physics? There may be several problems and it all depends on what approach you implemented the character control.
1) Is there a Rigidbody2D on the character? Body type dynamic? If not, then it is your code that should make the character fall.
2) Body type dynamic, Rigidbody2D is there, but the character still does not fall. It could be that gravity is off or on the wrong axis. Edit->project settings->Physics2D is checked. And on the character itself, Gravity scale = 1.
And a bunch of unpredictable problems that you can only guess about. To give a more accurate answer, you need to see the structure of your character and the code that controls it.

P
pavelzaipin, 2019-10-20
@pavelzaipin

If implemented via Rigidbody2D, then you need to check the freeze rotation z checkbox (in the constraints tab), it will not be able to rotate.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question