Some background: I’m making a 2D platformer (very similar looking to the 2D platformer tutorial). I’m having two problems with my character controller (CC) on moving platforms. Currently, I’m using the code from the 2D Platformer Tutorial to handle moving platforms. The pseudo code for moving platform support is as follows:
- Grab the platform the CC is standing on
- Detect the platform’s movement change (in Update()).
- move the CC by the amount in #2 using transform.position.
Here are my two problems:
-
I have a box hanging from a chain. The box cannot rotate. The box is swinging back and forth. The character stands on the swinging box and everything seems dandy! However, if the box swings too high towards the ceiling, the CC passes right through the ceiling! (because we’re adjusting the position with transform.position). Ideally, the CC would collide with the ceiling above, in turn pushing back down on the box. I’ve tried using controller.Move() for the “platform movement” instead of transform.position, but the character either slides off, or passes right through the box
-
I have a platform rotating counter-clockwise. The CC is standing on the right half of the platform (the half rotating upwards). When the platform reaches about 70 degrees, the CC falls right through the platform. Does this have something to do with skin width? Right now my CC has Height 1.8, Radius 0.3, Skin Width 0.1 on a Capsule of scale X=1, Y=0.8, Z=1.
Super duper duper thank you! ![]()
-Sean