Velocity and direction not remaining constant

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()

Do you have gravity enabled on the rigidbody?

check your settings in the inspector pannel. check if gravity scale is set to 1 and others

its set to 1

its set to 1 if that hekps

and whats the gravity in the project-settings?

maybe try resetting all parameter in the inspector menu to check if one of them is causing the problem

how? where do i go to reset

click on the bullet node, then on the right side of screen is the inspecter menu. there.

Did you make your bullet a RigidBody3D? Try changing it’s type to Node3D as is in the tutorial, both in the script and scene.

1 Like