I’ve gotten myself stuck on a problem for a while now. My player, which is controlled using my own script and a rigidbody2d, slides off my horizontally moving platform when standing on it. The hope is to have my player move around freely on the platform while it’s moving, without sliding.
I’ve implemented the use of Rigidbody2D.MovePosition() to move the platform as it was suggested here: Rigidbody on a platform - Questions & Answers - Unity Discussions, but the player still slides off. Perhaps I’m missing something to make this work?
I also tried adding the player as a child of the platform when standing on top of it, but that resulted in really clunky movement for the player. I also don’t think it’s a very logical solution so I’d like to avoid it if possible (unless anyone can convince me otherwise).
Last I’ve tried my own solution, which was to add the velocity of the platform to the player’s, but that didn’t seem to work either. I’m not entirely certain why it didn’t work or if I have made some coding mistake, but the logic seemed right I thought.
So if anyone could help me figure this out in a logical and clean way, I’d be very grateful!
Ps: If you need me to supply any of my code or a video of what’s going on, let me know.