Godot Version
4
Im trying to make a bullet, but it wont go straight, it will shoot out straight but start curving, like its on a leash or something and is being pulled upward in a exponential curve. following this tutorial: https://www.youtube.com/watch?v=6bbPHsB9TtI&list=PLQZiuyZoMHcgqP-ERsVE4x4JSFojLdcBZ&index=4&pp=iAQB
#bullet code
extends RigidBody3D
const SPEED = 40.0
@onready var mesh = $MeshInstance3D
@onready var ray = $RayCast3D
func _ready():
pass
func _process(delta):
position += transform.basis * Vector3(0, 0, -SPEED) * delta
if ray.is_colliding():
mesh.visible = false
ray.enabled = false
if ray.get_collider().is_in_group(“enemy”):
ray.get_collider().hit()
await get_tree().create_timer(1.0).timeout
queue_free()
func _on_timer_timeout():
queue_free()