where is parent for bullet?i add bullet instance to character.

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

but bullet is move after fire,when i move the character.
Which node should the bullet be a child of?

:bust_in_silhouette: Reply From: johnygames

It shouldn’t be a child to anything, because in that case it will copy the parent’s movement. What you want to do instead is just spawn the object where the gun is. You do that by instancing a new bullet and then changing its position to the position of the gun.

func _process(delta):
		var Bullet_Instance = bullet.instance()
		Bullet_Instance .translation = Vector3(gun.translation.x,gun.translation.y,gun.translation.z)
		get_tree().get_root().add_child(Bullet_Instance )

It means to be a child of the route.
Certainly the route does not move.
I understand.
Thank you.

bgegg | 2019-08-20 11:39