[Solved] Why isn't this ball jumping- Problem with physics

Hi,

I have a ball on the scene that has these physics properties:

ge2

I expect the ball jumps after getting an angular impulse.

What I expect:

but the ball moves to the right after pressing the Right arrow key.

Here comes my code:

Check the file here:

Where is the physical problem?

regards,

Saeed

Change first angle to 270, and second one to 0

Do you mean for the right arrow 0 and the left arrow 270?

I changed the right one to 0 again it moves to the right!!

Unfortunately, liluo doesn’t let me to logging in!!
so I can’t place the file here!

pres_coord2

https://wiki.gdevelop.io/gdevelop5/tutorials/basic-game-making-concepts/#angles

In your above reply, what is your meaning by the first angel and second angel?
Can you explain what should I do now?
Change the impulse?
Change the length?
Change the degree?

Check the file here:

You are applying the force at the sprite origin (Char.X(), Char.Y()), which is most likely the top left of the square that outlines the image. You want to apply the force to the centre of the object, that is Char.CenterX(), Char.CenterY()

First I transferred the sprite origin to the center of the sprite:

ge4

and changed the code as you said:

but still the same result:

the ball isn’t jumping to the right!

Remember this diagram from @Keith_1357?

It shows the angles that GDevelop uses. 45 degrees is to the right and down. You want an angle to the right and up; change it to 315 (or -45) degrees, and you should be good.

Yes, you are right. Now it works. Thanks a lot.
I appreciate all replies.

1 Like