Please I need your help to figure this out.
I have this formula that I have been trying to apply to my project.
I use the GoDot engine to create a 2D platformer game with projectiles.
static public Vector2 calculate_arc_velocity(Vector2 point_a, Vector2 point_b, float arc_height,float up_gravity=30, float? down_gravity=null)
{
if(down_gravity==null)
down_gravity=up_gravity;
Vector2 velocity = new Vector2();
Vector2 displacement = point_b-point_a;
//GD.Print(displacement);
if(displacement.y>arc_height)
{
var time_up = Mathf.Sqrt(-2F*(float)arc_height/(float)up_gravity);
var time_down = Mathf.Sqrt(2F*((float)displacement.y-(float)arc_height)/(float)down_gravity);
velocity.y = -Mathf.Sqrt(-2F*(float)up_gravity …