Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Alexander Taylor | |
Old Version | Published before Godot 3 was released. |
Hi,
I am trying to create a simple moving platform for a simple 2D game where the player is a ball. The player has a RigidBody2D as I need the accurate ball physics for it, such as rolling and stuff.
It works reasonably well but I do not know how to implement the traditional moving platforms as they do not seem to carry the player with them, the player stands still as they slide underneath. I have also tested this with a box shaped rigidbody and that also slides as the platform moves underneath it.
I have tried implementing the platform as a StaticBody2D, RigidBody2D (as static) and then as a KinematicBody2D. None seem to grab the player and then move the player with them.
I really don’t want to “fake” it, I would like to have the actual physics engine achieve this. Is there something that I am missing?
Thanks.
Have you tried applying additional force on y when the player is on the platform ? Additional force or an increase in gravity should make it stick, I haven’t reach that point with my game but I did some reading and analyzed other codes.
MrMonk | 2016-10-19 08:39
Scaling the gravity up to really ridiculous amounts did work but I think it’s a bit of a hack; gravity scale has to be like 1000 to work and I don’t know if it works for ball shapes.
The suggestion has made me realise that I haven’t tried setting the platform StaticBody2D’s constant linear velocity to down. It might keep the ball stuck to it though I’d imagine it would affect its gravity and friction a lot so it might make jumping off it difficult.
Alexander Taylor | 2016-10-19 08:49