+1 vote

I made this question earlier in the godot discord but I didn't get much further, might as well see if someone can help me here. Let me know if I need to clarify anything further or post some code.

I'm using RigidBody2d character mode for my player and I'm facing some barriers. Being more specific I want to have moving platforms in my game and friction doesn't do a good job at "Linking" a moving KinematicBody2d to a RigidBody2d.

I would really like to keep the Rigidbody behaviors(gravity, damping, impulse, force) and have the ability to snap my player to the platform/add the same amount of speed as the platform (or any other solution you could help me think about). I spent the afternoon trying to figure this out but didn't find anything that would help me with this so i tried Kinematicbody2D wich was not as good as i expected, it looks like I'll have to do a lot of work to get close to what I have now and I don't even know how I would go about coding those behaviors.

So the question is, should I stick to the RigidBody2d approach (If yes what should i do?) or should i consider a lost cause and go for reproducing those behaviors in a KinematicBody2d?

Even if you dont have an answer to this I would really appreciate an opinion about it.

asked Jun 26 in Engine by Lucca (18 points)

I take you've already read about the move_and_slide_with_snap() function that comes with a KinematicBody2D?

Yes! The main problem here is that if I try to apply the same speed to the RigidBody2D it doesn't translate well since its another function that's applying the force.

1 Answer

+1 vote

Can't you detect a collision with the RigidBody2D see that it is a platform that you are colliding with. You know the speed of the platform so set RigidBody2D accordingly.

answered Jun 28 by LLJ (22 points)

Sorry for the delayed response,
How would i do that if the platform movement and the player movement are being applied differently?

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 How to use this Q&A? before posting your first questions.