Gdevelop - How do I make an object move in a arc movement from a X start pos, Y start pos to maxX pos, maxY pos in a maximum Y position high

How do I move an object in a arc movement, im trying to make this arc move without physics (if possible), there I made an ilustration with example values on it, remembering that the Y start position sometimes isn’t the same as the end Y position:

Hi! This other post might help:

1 Like

Hi,

for another solution you need the lerp-function and some math for calculating the parabola.
For your given values, the events can look like this:

First, you need an object variable t, which will be the interpolation factor in the lerp function. In this case it will be TimeDelta().

For the x position: lerp takes three values, in your case (1) start x-position, (2) end x-position and the third value is the interpolation factor which is for you (3) the object variable t (“ball.t”).

For the y position you do the same: lerp(y-start position; y-end position; ball.t).

This would move the object in a straight line but you want a parabola. For a symmetric parabola, you can use this formula:
4 * ArcHeight * ball.t * (1 - ball.t)

Combine both and you get a symmetric parabola movement:
lerp(y-startPoint, y-endPoint, ball.t) - (4 * ArcHeight * ball.t * (1 - ball.t))

You can change the ArcHeight value as you like and if the y-start or endPoint changes, you need to store it in a variable and put this in the formula instead of hardcoding the values.

If you want to change the time scale you can divide TimeDelta() by a different value than 2.

Disclaimer: I wish I would be skilled enough to come up with stuff like this myself, but the parabola formula and adding to t TimeDelta() / 2 is from ChatGPT.

1 Like

Arc or more like angle is -45 find your angle

2 is how strong push will be i set it to 5 and it went way too fast
So use decimals
I think something like 3.1 or 2.5 will better for you but that is something you need to trail and error

Hit space

2 Likes