Following a Path3D, can't decide whether to use CharacterBody3D or RigidBody3D or?

I managed to get idea 3 “Use RigidBody3D while keeping my existing railway movement/tilting code.”

I did it by setting custom_integrator to true on ready. Then switching it back to false when crashing so the default physics takes over.

func _integrate_forces(state):
	if custom_integrator:
		state.linear_velocity = global_basis.z * -current_speed
	else:
		current_speed = state.linear_velocity.length()

This seems to do exactly what I want and doesn’t seem to cause any issues with the physics server. I’m still not sure if this is the best idea, and I’m a little worried it just appears to be working by coincidence rather than design…

Any thoughts/ideas/help still very much appreciated.

I also attempted idea 2 “Use RigidBody3D and reimplement my railway moving/tilting code to use physics.”, but I couldn’t get that working. The train just started accelerating immediately without any input, I assume this was caused by the RemoteTransform3D moving the RigidBody3D manually :man_shrugging:

1 Like