Draw the scoring path

How can I draw a line for the same path the ball will take before being thrown by the player, given that the player rotates 360 degrees with the direction of the mouse, and given that the force of the ball is thrown differently from time to time
I watched some videos and searched for the same properties of the track as what I talked about, but I couldn’t find it

I think we need more information. What type of game is this? What type of ball? Is this top-down? Are you using physics?

The game is a cannon that shoots balls
The balls are dynamic physics
The location of the cannon and the power of the throw is different at each level
The cannon directs the ball anywhere in the vicinity of 360 degrees

Sounds like you’re after a trajectory path. Here’s a version of it made by WishForge games.

I’ve seen this video before but it doesn’t explain how to take the same path as the ball.
The cube in the video is the same as the ball, but in my game, I have a cannon that throws the ball, and the cannon will go where the mouse is going, and when the cannon throws the ball, it has to go exactly in the direction of the drawing. This is what I want to solve

So do you want the canon ball to fly in an arc, or a straight line? Does the game have a top down view, side on, 3D isometric or something else?

-The game is a portrait, not a landscape.

-The ball has throwing power for example 35 in the fifth level and for example 15 in the Sixth level
It may be arc or it may be straight. This depends on the strength of the throw, but what I want from the line is that it takes the shape of the path of the ball that it will take before throwing, according to the direction of the mouse that directs the cannon’s barrel.

-Sometimes the cannon may throw the balls from top to bottom or vice versa, depending on the cannon’s location

-Look at this video. I have the same cannon, but I want to draw the exact path the ball will take before throwing Cannon ball (Physics) | Gdevelop 5 - YouTube

Does anyone know the solution?

I think the problem is that it’s still a bit vague. What is the cannon shooting at? Can you
post a pic of the scene or gameplay and/or the events that are currently targeting and firing the ball? The more details the better.

Look at this video. I have the same cannon, but I want to draw the exact path the ball will take before throwing Cannon ball (Physics) | Gdevelop 5 - YouTube

Yes it does. It plots the trajectory the cube will take, and that is all explained in the video from this point. You may need to modify it a bit to suit your need, but it does exactly what you have requested.

In a nutshell, instead of aiming where the mouse is, you use the same angle and force on the aiming object as you would on the cannonball.

I think what you need is to add a shape painter to trace the line path trajectory of your cannon ball before you shoot.


Thank you but its not what I want

Well, I’m trying, and I think I’ll do it, but it seems like it’s going to take effort and time.
But I didn’t know that when aiming, I needed a dynamic object and had to balance weight, gravity, and force to match my throw.
Why not add an extension so that aiming takes the trajectory of a throw before throwing, that saves a lot of time and effort.

I think the issue is that things are still a bit unclear. It would help if you could post pics from your project. The actual cannon, in action if possible or a screenshot of the events that launch the projectiles.

You said it was just like a cannon but then also said it might shoot from the top towards the bottom in 360° That’s not how the physics works. I’m still unclear if this is a side view or overhead/top down.

Well it’s my game

Is that ball going in the right direction? And why don’t you apply a force at the same angle as the cannon?

The ball goes according to the direction of the cannon muzzle at a certain point at the hole and the cannon head where the mouse center

look at the aim here going as the ball

It is like a waterfall and close to each other.
If you reduce the intensity, it will disrupt the correct trajectory of the ball.
Even for gravity if I tighten it it doesn’t go in the right direction perfectly

Density is to do with the physics property. What you’ll want to do it put a timer that delays sending out a ball to every 0.2seconds, or whatever delay looks good.

Don’t mess with the physics properties. It’ll affect the trajectory and create one that doesn’t match the cannonball path.

I really thought about doing this but was looking for a better way
I will try and let you know what happens