Alright, so I was able to figure it out. You do indeed have to use both methods, and transfer information between them using a temporary variable (such as Vector2).
public override void _Input(InputEvent inputEvent)
{
InputEventMouseMotion motion = inputEvent as InputEventMouseMotion;
if (motion != null) {
mouseSpeed.y += motion.Relative.y;
mouseSpeed.x += motion.Relative.x;
}
}
private Vector2 mouseSpeed;
public override void _IntegrateForces(PhysicsDirectBodyState state)
{
Vector3 angularVelocity = Vector3.Zero;
Transform transform = GetTransform();
angularVelocity -= mouseSpeed.x * 0.125f * transform.basis.y;
angularVelocity -= mouseSpeed.y * 0.125f * transform.basis.x;
mouseSpeed = Vector2.Zero;
state.AngularVelocity = angularVelocity;
}
This code is designed for RigidBody nodes in any orientation.
Also, ensure that the "Can Sleep" property of the RigidBody node is Disabled, otherwise the _IntegrateForces()
method will not be called!