Hello, I'm new to Godot, and am trying to make the switch! RigidBody physics are giving me a little trouble at the moment, however:
I am trying to write a simple 3d game in which you move an object around in space via attached thrusters. To test that I have the basic physics working I created a RigidBody node, with an attached Spatial representing the thruster. Also attached is a CollisionShape (box)
I put the thruster on the bottom of the object, offset to the side a little bit. It should fire, rotating the object since it's placed off to the side.
Here is the integrateforces code:
func _integrate_forces(state):
var thruster = self.get_node("BottomThruster")
var force_vector = thruster.get_global_transform().basis.y
var pos = thruster.get_global_transform().origin
state.add_force(force_vector, pos)
What happens is it thrusts and rotates just fine, until it is facing the scene origin, at which point it keeps going straight towards the origin. When it crosses over, it rotates back around to face the origin. It just keeps oscillating to face the origin at all times!
Is there something I am forgetting to do to update the body? Or am I not using the correct vector for force?
Thanks for the help!