Here is the code of the spawn object that is a rigidbody node:
func spawn_asteroid(): var spawn_position: Vector3 = get_spawn_position() var asteroid_instance = asteroid_scene.instance() asteroid_instance.transform.origin = spawn_position spawned_asteroids.append(asteroid_instance) # Push towards player var direction_to_player: Vector3 = player.transform.origin - spawn_position asteroid_instance.add_force(direction_to_player * asteroid_speed, spawn_position) add_child(asteroid_instance)
There is no add_torque nor any additional code to handle the rotation, however, when an object is created, it rotates like a spinning top.
I first thought that it caused the intersection of two rigid body objects that were pushing and causing rotation, but this was not the case.
I do not know why they turn. Is there anything that I missed? Unlike Unity, there is no way to stop their rotation. Use Godot 3.1.1.