2 Character Controller moving Platform problems!

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:

  1. Grab the platform the CC is standing on
  2. Detect the platform’s movement change (in Update()).
  3. move the CC by the amount in #2 using transform.position.

Here are my two problems:

  1. 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

  2. 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! :slight_smile:

-Sean

A complicated collision like this is going to be difficult to handle kinematically. Is the swinging box controlled by physics? I would recommend, if possible, that you use physics to control everything while the character is on the box.

I’m not exactly sure how to visualise this. Is it a flat/box-shaped platform? Is the idea that the character is supposed to slide off the platform but actually falls through it instead?

Rather than try to re-explain my really bad explanations, I’ve changed to a rigidbody and I’m having alot more successs :].

As you noted, I really need to be taking advantage of the physics engines in situations like this. <3 rigidbodies!