shooting in 3D not working

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By master8829

I’m working on a game that is 3D
I have a raycast that follows the players orientation i need to know how i could shoot a bullet scene on the ray cast

if Input.is_action_pressed("shoot") and $neck/Camera3D/pistol/AnimationPlayer.current_animation != "kick":
		#if raycast.is_colliding():
		#	var hit_player = raycast.get_collider()
		var bullet = bulletsd.instantiate()
		if $neck/Camera3D/pistol:
			bullet.global_transform.origin = $neck/Camera3D/pistol.global_transform.origin
			bullet.global_transform.basis = $neck/Camera3D/pistol.global_transform.basis
			bullet.set_linear_velocity(-$neck/Camera3D/pistol.global_transform.basis.z.normalized() * bullet_speed)
		#bullet.damage = bullet_damage

Edited to fix code formatting…

jgodfrey | 2023-05-14 15:49