Package Throwing

Godot Version

4.7.1

Question

I am trying to make a throwing mechanic for my game, but I can’t get it to work. The object I am trying to throw is a RigidBody3D.

if Input.is_action_just_pressed("Throw"):
		if closestPackage != null:
			remove_child(closestPackage)
			get_node("/root/Main/Packages").add_child(closestPackage)
			closestPackage.velocity = Vector3(0, 0, 0)
			closestPackage = null
			set_meta("holdingPkg", false)

Here is what I have so far, it doesn’t work.

You need to do something like:

var new_packet = [name of your packet scene].instantiate()
get_node(“/root/Main/Packages”).add_child(new_packet)
new_packet.global_position = get_node(“/root/Main/Packages”).global_position

I was not entirely sure what to put for the packet scene name, so could you explain that in more detail?

Whatt dose not work?
Dose the ball dose not spawn at all?
Do you get any errors?
I recommment you to reed the forum guidelines: