The Godot Q&A is currently undergoing maintenance!

Your ability to ask and answer questions is temporarily disabled. You can browse existing threads in read-only mode.

We are working on bringing this community platform back to its full functionality, stay tuned for updates. | Twitter

+1 vote

In the game Dread Hunger, when player climbs up onto the ship, the player moves along with ship from the perspective of the world space. When the player jumps off the ship the connection is cut off and player moves relative to the world space again not to the ship.

How can this be done with Godot? I've tired two methods but failed:

  1. Change the hierarchy on the fly: When player enters Area, remove the node from world and add it into the vehicle node.

  2. Sync the transformation (take translation as example): In physicsprocess, apply the delta translation to the player node.

Godot version 3.5.beta
in Engine by (37 points)

2 Answers

+1 vote
Best answer

Problem solved. I change the ship from staticbody to kinematicbody while the floor is still staticbody and move the ship through move and slide instead of translate

It seems it's not a good ideal to modify the translation of a rigidbody directly and staticbody is supposed to be static.

by (37 points)
0 votes

These methods should work. Why did they fail ? What happened ?

There is another method. You can use RemoteTransform node to temporarly set players transforms to those of the ship.

by (8,188 points)

Both methods result in dropping through the floor.

For debug purpose, when I press F3, the ship accelerates. The player drops through the floor when I keep pressing F3 for over seconds. At the begining everything works fine but after a while the player drops through the floor. Looking up, I found the z speed remains the same with the ship but the player drops through.

Are you using bodies for player and ship ? Are they the same body class ? ( like rigid or kinematic ) ?. Bodies transform is constantly afflicted by physics engine, it will not be as easy as copying them.
Is it supposed to behave like moving platform ?

Ship is StaticBody and player is KinematicBody. Yes it is supposed to behave like moving a platform while player can walk around on it and jump off it.

watch this youtube tutorial by Pirate Chip Games, it's probably what you are looking for.
Make a 3D moving platform w/out player falling off (fps)
He uses an area and move_and_slide_with_snap with some other things, I hope that will help.

Setting stoponslope to false suppose to prevent the player from dropping. But stoponslope is false by default (which means it is false in my code), the youtuber solved the problem where it has to be true on some cases.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.