Making Rigidbodies the parent of character controllers is giving me problems.


I am currently having two problems with the parenting script in a 2D platforming game.

  1. I have a platform(rigidbody) that is floating and rising with the water level, and whenever the character is on the platform I would make the platform the parent of the character, so now the character will rise with the platform without falling of. But then I have another rigidbody falling on the platform causing it to rotate. Once the platform is rotating due to the physics engine, the character starts to rotate with the platform, and once rotated he would stay at an angle for the rest of the level. Any solutions to this problem?

  2. I have wrote another script to make another platform to be the parent of the character. But for some reason if Im using both scripts, only one of them will do the parenting and the other script will not. And If I use only one, once I land on the second platform my character is following the position and rotation of the old platform. What is the reason for that and how to solve this issue?

Is there other ways to accomplish what I want to do?

Any help is very much appreciated.
Thank you very much.

  1. In this case I don’t parenting is the right solution. If you have not already, you should try out the “Character Motor”-script that comes with the standard assets package “Character Controller”. It got code ready for handling platforms and sliding.

  2. If the above works, this should not be a problem. In the future, for similar kind of questions, you should write the code from your scripts here.