Godot Version
v4.5.rc1.official [08e9e6b29]
Question
I have a pretty simple scene with a floor and a wall. There’s a CharacterBody3D and I shoot bullets which are RigidBody3Ds.
However, the bullets don’t “collide” with the ground or the wall. The ground and wall are StaticBody3D. Every so often one does collide, often with a separate bullet. Other times, they just pile up, not being detected.
My bullet code:
extends RigidBody3D
@export var speed = 10.0
func _physics_process(delta: float) -> void:
move_and_collide(-transform.basis.z * delta * speed)
func _on_body_entered(body: Node) -> void:
if body is StaticBody3D:
print('static')
queue_free()
print('dead')
So, you can see it should always “die” after detecting, and print “dead” and possible “static”. However, they don’t print “dead” and don’t go away.
My bullet scene, you can see it’s just some meshes with a box collision mesh:
My player scene is a mesh, a collision shape, a pivot with a camera, and a marker for where the bullets will originate:
The player script is also pretty basic:
extends CharacterBody3D
var gravity = ProjectSettings.get_setting("physics/3d/default_gravity")
var speed = 5
var jump_speed = 5
var mouse_sensitivity = 0.002
var yaw: float = 0.0
var pitch: float = 0.0
@onready var cam: Camera3D = $CameraOrient/Camera3D
@onready var bulletStart : Marker3D = $bulletStart
@onready var cameraPivot : Marker3D = $CameraOrient
var bulletScene = preload("res://bullet1.tscn")
func _ready() -> void:
Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
func _physics_process(delta):
# Gravity
velocity.y += -gravity * delta
# WASD movement
var input = Input.get_vector("move_left", "move_right", "move_forward", "move_back")
var movement_dir = (transform.basis * Vector3(input.x, 0, input.y)).normalized()
velocity.x = movement_dir.x * speed
velocity.z = movement_dir.z * speed
move_and_slide()
func _input(event):
if event.is_action_pressed("rotate_lock"):
if Input.mouse_mode == Input.MOUSE_MODE_CAPTURED:
Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)
else:
Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
if event.is_action_pressed("fire"):
var newBullet = bulletScene.instantiate()
newBullet.position = bulletStart.global_position
newBullet.rotation = bulletStart.global_rotation
add_sibling(newBullet)
if event is InputEventMouseMotion:
rotate_y(-event.relative.x * mouse_sensitivity)
cameraPivot.rotate_x(-event.relative.y * mouse_sensitivity)
cameraPivot.rotation.x = clampf(cameraPivot.rotation.x, -deg_to_rad(70), deg_to_rad(70))
# Apply yaw to the player body (Y axis)
if Input.mouse_mode == Input.MOUSE_MODE_CAPTURED:
cam.rotation.y = yaw
else:
rotation.y = yaw
# Apply pitch to the camera (X axis only)
cam.rotation.x = pitch
My main scene is simple:
But when I run and shoot bullets:
no “dead” or “static” is output until they collide with my character model



