Trouble with getting 3D ballistics correctly

Godot Version

4.2.1

Question

Hi, everyone! I’m writing a 3D isometric in which I have a certain class that is able to shoot bullets that should arc in their trajectory straight towards the target position. Ideally, the bullets should be RigidBodies that stay in the map a while after being shot, however lose their damaging capabilities after first impact.

However, I’m having trouble with figuring out the whole ballistic projection part of the shooting.
Right now, my function, being called from the shooter’s script into the bullet’s script, is as such:

func launch(shoot_point, target, strength):
	transform = shoot_point.global_transform
	var direction = shoot_point.global_position.direction_to(target.global_position)
	
	apply_central_impulse(direction * strength)

In the shooter’s class, it is called as such:

func _shoot(bullet:PackedScene, shoot_point:Marker3D, target:Node3D):
	var b = bullet.instantiate()
	add_child(b)
	b.launch(shoot_point, target, 20)

In which shoot_point is a Marker3D placed where the bullet’s supposed to come out.

The “20” strength value is just a placeholder, as I see that this function shouldn’t have a strenght value being passed at all, since the strength would be relative to the distance needed to cover.

Right now, the shooting is going like this:

And what I want is a parabola that starts at fixed angle range (it can be 30-60º) and only touches the ground at the target’s position, like this:
1712718381-195211-image

Perhaps the angle can be the only variable to be solved when calculating the touch point, and the strength remains fixed.
The cannonball’s weight is unimportant and will be fixed for everyone that uses this shooting mechanism.

How can I modify my shooting function so that it works properly? Thanks!

Anyone? :frowning:

you can make a path3D and make the bullet go on the path for a nice curve