Walking Inside Vehicles is much easier than you think

When using Godot and you want to walk inside a moving car or ship, how to achieve this — you just need to set up node hierarchy correctly, godot will automatically convert movement to local space .

But don’t use RigidBody as the interior of vehicles, because you won’t like walking inside a moving RigidBody, AnimatableBody or VehicleBody. Simply use StaticBody for the “interior ground”!

Then, for each frame, you can use a real RigidBody or VehicleBody to “drive” that StaticBody that the player is parented to.

Example setup :

node tree like :

Staticbody update script (syncing transform from the Vehicle’s Whatever Body) :


extends StaticBody3D


func _physics_process(delta: float) :
	self.global_transform = $"../Ferry Simplified Experiment".global_transform

Video demo (testing GodotOceanWave with bouyancy):

7 Likes

Doesn’t the CharacterBody3D’s “Moving Platform” properties handle this? I don’t think you need a Static body as a parent, nor to copy the transform so long as your mask/layers and rigid body are set up correctly.

2 Likes

Great demo, now tell us how you made that water!!

1 Like

I believe Moving Platforms are intended for platformer games. Using static body as a parent is the best method I’ve found so far, other approaches will have various issues. for example player clipping through walls and eventually falling off accelerating moving vehicles.

I didn’t make the scene myself. The water is from GodotOceanWave , which uses FFT-based ocean simulation.