- Home /
How to prevent Character Controller from falling through moving Platforms?
My Character Controller reproducibly falls through vertically moving platforms. The Character is parented to the moving platform as soon as it enters a trigger box colider above it.
This fall trough is more likely to happen if the charcter falls a long distance and if the platform is moving up. Or with other words: the stronger the collision force is the more likely it is that the character slips through the platform. At a certain force it always falls through.
Any help is much appreciated!
Answer by Felix King · Sep 11, 2012 at 07:11 PM
For me changing the Fixed Timestep in Edit -> Project Settings -> Time down to 0.01 solved the problem.
Answer by DesiQ · Sep 09, 2012 at 09:23 PM
There is a Moving Platform field in the Character Motor script of the default Character Controller in Standard Assets. Did you enable it?
DesiQ I have the exact same problem as Felix $$anonymous$$ing and the $$anonymous$$oving Platform field did not solve the problem, the player character still falls through moving platforms handily. I've had this problem for weeks now actually and I'm planning on switching to a rigidbody/physics controller...
I don't know much about it because I haven't had to implement it myself. I'd suggest reading through the Character $$anonymous$$otor script to understand how the moving platform option works. $$anonymous$$aybe there's a way to tweak it for your game.
For me that didn't help as well. The only thing that helped was changing the Fixed Timestep in Edit -> Project Settings -> Time down to 0.01. The Character only falls through the moving platform when jumping on them from rediculous heights. But you could go even lower with the fixed timestep to prevent that. I have to check how much it affects the performance on mobile devices though ...
Answer by Felix King · Sep 11, 2012 at 10:40 AM
Thanks for the Feedback. I did not know about that! Looks like I have some additional research to do ;)
Remember to mark my answer as correct if it solved your problem.
Answer by avidesk · Sep 14, 2012 at 04:17 PM
Fixed timestep will surely help, but sometimes you can only get it to go so low before it impacts performance. Changing the collision detection mode of your object's rigidbody to Continuous or Continuous Dynamic is probably what you want. Now if the collision occurs between two fixed time steps, it will still be detected. If that happens and collision mode is set to Discrete, the collision is not detected and it passes through.
(Only use this for objects that need it, it will impact performance if used all over the place)
Thanks! I played with that as well, but had some issues. First you need a rigid body ins$$anonymous$$d of a character controller, which means I have a lot to change and second the rigid body sometimes gets stuck a little bit while sliding down walls and in some occasions it "catapults" the rigid body into the opposite direction. I think this might be likely due to the poor quick & dirty implementation during the testing. For the next project I'm thinking about switching to rigid bodies.
Your answer
Follow this Question
Related Questions
2D 360 degress platformer example needed 0 Answers
Gun collision problem 3 Answers
Make character interact with object without using unity Physics 0 Answers
Collision problem 1 Answer
Determinism of collision judgment of Character Controller 0 Answers