Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Lucksinia |
So, I have this snippet of a function that creates instance of a Bullet(RigidBody2D) on position of $BulletPoint(Node2D):
func create_bullet_instance(object:Bullet):
var bullet_instance = bullet.instantiate()
bullet_instance.position = bullet_point.get_global_position
bullet_instance.rotation_degrees = rotation_degrees
bullet_instance.apply_impulse(Vector2(0,0), Vector2(object.speed, 0).rotated(rotation))
get_tree().get_root().add_child(bullet_instance)
await get_tree().create_timer(object.lifetime).timeout
bullet_instance.queue_free()
And, apparently, rotation is still got up from Node2D, but not position?
What do I do in this case?