# [Solved] How to move an object along an arc

What is the easiest way to move an object along an arc under a given time?

The Curved movement extension I found requires predefined paths, however in my case I only know the angles and radius of the arc - but not the position - ahead.

I also found this example, but I want the object to move along only a given arc, and not a full circle.

1 Like

I really want to know about this because a lot of games use it. I have an idea as creating points through an arc and moving the instance one from another to move it across a path. But how to do that? Iâ€™m most positive we can do it in gdevelop.
Maybe this video would help: (1) Add Aim Feature in GDevelop 5 - Physics Engine Tutorial - YouTube

Whatâ€™s stopping you from using the `Put object around another` action once you know the centre of the arc?

What do you want to move along the arc? A little more context might help get a better answer. Have you thought of using the physics behavior?

The setup I have is something like this:

These tiles with different roads on them will be placed next to each other. Then I need to move the player along the road itâ€™s currently on.
Since the road on the right tile only contains straight segments, I used the tween on the player to move it. But for any of the paths on the left tile I canâ€™t use tween.

Additionally, all of this player movement is defined in a function and then used in an event with Trigger once as a condition, so I donâ€™t see a way to use the `Put object around another` action.

1 Like

Something Iâ€™ve wanted to try is using the Read Pixel extension to read the color at a point and use it to follow a line. IDK if it would work in this situation. (Sort of like those line following robots)

As mentioned, you could use place around a point and either use numbers or points on the object as the center point.

This example uses the cursor as the center position and a variable tween to tween the angle from 0 to 180. The speed can be adjusted by calculating the length of the line.

1 Like

Thatâ€™s exactly what I was thinking of, but I didnâ€™t know about the Read Pixel extension.

But I guess the other solution with the `Put object around another` is the easiest to implement so I will use that.

I started working on a project. There are different strategies. This uses a center front point for movement and left and right to turn. It doesnâ€™t work well with sharp turns. I want to try other strategies. Iâ€™ve used these strategies in a bot game called LogicBot. When I get the bugs fixed, I might start a new thread.

It requires a consistent line. So, to draw the line I added another sprite that will follow the mouse when itâ€™s pressed. The bot and drawing dot are both draggable. Again, this is very early and crude.

Iâ€™m unsure when I can finish this.

Try online, draw a line and then place the bot on the line.

Edit: there are multiple strategies. You can put the â€śsensorsâ€ť on the line or outside of the line and flip the way it steers. You can also do a combination of both.

2 Likes

The difference between this solution and the way real robots follow a line is that a sensor of a robot will measure the reflected light from the surface, and in case of a white background and a black line, it will return any â€śbrightnessâ€ť between 0 and 225. This is useful because then you can then change the steering angle based on this value. But I think it would be quite complicated to implement this behaviour in Gdevelop.

1 Like

Use whatever technique you think fits your project the best. Iâ€™m still going to play around with the idea for fun. I wish you well.

1 Like