i made a 2d player with rigidbody 2d.
I’m trying to jump by applying a force, but it doesn’t seem to work.
Where am I doing wrong?
I am attaching the rigidbody screen maybe I have some settings wrong, I tried to change the mass and gravity scale, but nothing.
I also attach the code, I put a log but the y position is always 0.0
So for starters, you should NEVER modify the Transform when using 2D physics. The Rigidbody2D is in charge of the Transform and writes to it so you shouldn’t. What you’re doing here is even worse though; you want forces to work but you don’t understand how they work (they modify velocity which updates position) because you are also then asking the Rigidbody2D to move to an explicit position via MovePosition!
How can it do both? Answer: It cannot.
If you want to manipulate immediate changes as well as using forces then modify the X component (not the Y component) of the Rigidbody2D.velocity and let it update the position. You can then add impulses to jump which only affect the Y component of the velocity.
MovePosition just makes it move to that explicit position.
Sounds like you need to use Unity Learn and follow some of the basic 2D Physics tutorials on movement. Also there are lots on YouTube etc that should help.