Player doesn’t stick on platform, when platform gone player will fail down (because of gravity)
The Player must be dynamic Rigidbody2D, the platform does not have to be kinematic Rigidbody2D.
But when I remove physics from platform (also set player to be child of platform) player moves slower on the platform than on the ground and there is jittering that’s why I made platform kinematic rb
Can someone tell me why player not moves with platform when both uses physics? And how to fix this
Another way is to connect the player to the platform using a FixedJoint2D, then destroy that when he leaps or falls off.
Another way would be to implement your own tracking that you’re on a platform, each frame use the motion of the platform between previous to now and combine that with player input to move the player.
There’s probably Youtube tutorials with even more crazy ways to do it.
I’m moving the player the same way and I set the platform moving the same way, but my player speed is slowing (less when moving with platform direction) and there is some chopping when the player moves on the platform. I want a player on the platform to move the same speed as on the ground (That moving is done using platform kinematic and moving with MovePosition, but in that case I have problem sticking a player on the platform).
Platform kinematic, moving with MovePosition
Platform without physics, moving with transform.position and Player parenting to platform ()
Both rb.velocity, and transform.position are relating to the global speed, and position, which is the players local speed + the platform speed. So it’s expected behavior. If you instead wish your player should move relative the platform it’s parented to, use relative force, or positions instead. Or just add the platform movement to the equation when the player is moved on the platform.
Say you want to achieve this with physics only, it’s the friction value which can be used to make it “stay in place” to some extent. So, if both objects use a material with high friction, the player would “rest” relatively to that platform.
However, as soon as an abrupt acceleration occurs, your player would fall victim to its momentum. For instance, suppose the platform moves horizontally only, and it’d slow down or even change direction quickly, then the player might slide off the platform, or at least closer to the edge.
If you need more control, it might be better to not use a dynamic rigidbody, but a kinematic one and control the entire movement via code.