Godot Version
v4.4.1
Question
Not sure if this is the right forum for this, but I have a question about the easiest way to code shooting out bullets in an arc shape (like a shotgun) here’s a pic to show what I mean.
(green lines just for debug, and blue lines to help show what I’m aiming for)
I currently just shoot 1 red bullet towards the mouse position like this:
func shoot_bullet() -> void:
var bullet: Test04Bullet = bullet_scene.instantiate()
bullet.set_position(position)
bullet_direction = -(position - get_global_mouse_position()).normalized()
bullet.set_direction(bullet_direction)
get_parent().add_child(bullet)
# Physics process function
func _physics_process(delta: float) -> void:
position.x += direction.x * SPEED * delta
position.y += direction.y * SPEED * delta
And have no idea how to achieve the effect I want based on that. I tried mucking around with the .dot() function, but didn’t really understand it or get anywhere with it.
Anyone got some pointers?