Ugh, this is not going well. First I jumped for joy when I saw RB/VB had a mode for KB but it doesn't inherit with move_and_slide
so I'm not sure what the point of it is. Then I saw they had this and gave a 2nd premature cheer:
func _integrate_forces(state):
state.add_central_force(velocity)
But it has no effect at all. Yet the docs give the following example for a customer look_at
function with a RB:
func look_follow(state, current_transform, target_position):
var up_dir = Vector3(0, 1, 0)
var cur_dir = current_transform.basis.xform(Vector3(0, 0, 1))
var target_dir = (target_position - current_transform.origin).normalized()
var rotation_angle = acos(cur_dir.x) - acos(target_dir.x)
state.set_angular_velocity(up_dir * (rotation_angle / state.get_step()))
func _integrate_forces(state):
var target_position = $my_target_spatial_node.get_global_transform().origin
look_follow(state, get_global_transform(), target_position)
So why does set_angular_velocity
work and not add_central_force
? Worse, sav is listed as a method for RigidBody2d and isn't in the docs RigidBody... I guess it's an omission, I'm taking it as read the tutorial code works.
Of course, I might just be kidding myself and this will actually need a custom physics module for the wheels to work but I can't see anything in the docs about how to do that...