[SOLVED] Sine wave movement

Hello,
do you know the correct expression to force a movement like the red line .
I would like to move a bird looping from from point A to point B (when the B position is reached change the position to A again).
I suppose that is necessary to use Instant force but I don’t know the correct expressione value.

I suppose it should be a solution to use one of these formulas:

Thanks,
J

I asked for math like this recently then here is the formula I used:
`150+ ((1+sin(TimeFromStart()))/2) * 50`

• `150` is an offset if you need one.
• `1` is here to make the sin range value in the positive range, otherwise the result is -1 to 1, so with this the range is from 0 to 2.
• `TimeFromStart()` is a GDevelop expression.
• `/2` to make the range from 0 to 2 become 0 to 1.
• Then `50` is the amplitude.

That make the things moves by 50units.

1 Like

Bouh’s math looks correct to me.

As a heads up, there are a few extensions that can do this for you, too

Thanks a lot, it works !

I tried before to open this topic but I wasn’t able to use the extansion in this way.

Thanks.

1 Like