• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
14
Question by rocket5tim · Nov 24, 2009 at 01:27 AM · animationphysicscharactercontrollermoving-platformmove-with-moving-platform

CharacterController falls through or slips off moving platforms

I made an animated elevator/platform by creating an animation in Maya and then attached a box collider as a child of the animation so that they move together. However my player uses the CharacterController and it falls thru the box collider (floor) as soon as the elevator starts animating*.

There are a couple of threads on the unity forum (here and here), but one of them is very old and neither of them has current or clear explanations of why the CharacterController has issues with attaching to moving objects and how best to solve the problem.

*note if I keep the player moving while the elevator is in motion, he does not fall thru the floor - he only falls thru when standing still. Also he's more likely to fall thru while the elevator is moving up than down.

Comment
Add comment · Show 2
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image ecameracci · Jul 23, 2015 at 11:17 PM 0
Share

I found this video helpful https://www.youtube.com/watch?v=U1Uk$$anonymous$$w12pQo

avatar image Michiyuki13 · Oct 15, 2015 at 09:45 AM 0
Share

Hey guys, that simple JS parenting script worked in my case, thanks!!! :D

However, I have noticed that it works much better with my animations imported from $$anonymous$$aya (or perhaps it's the mesh itself,and the trigger box generated from that mesh (it's just a duplicate)). The collider is set to convex,otherwise it wouldn't let me check 'is trigger' box.

Another moving platform was created with a Unity's cube and the trigger cube was done the same way,uses animations created with $$anonymous$$echanim, and whenever my character steps inside the trigger zone, its feet start sinking in a bit... I'm using that standard Ethan char to run around the level.

$$anonymous$$aybe this observation can help somebody out with the similar issue. I guess I need to test with another object imported from $$anonymous$$aya.

A programmer friend is going to help me with this in the next couple of days,I know parenting is not the best solution,but the other ones are too complicated for me (game artist here xD). If he does something cool,I'll post it here!

9 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by Aram-Azhari · Feb 02, 2013 at 07:33 AM

I found another way that I think is not mentioned here.

1- Attach the player to the platform.

2- IMPORTANT STEP: Turn the Moving Platform - Enabled Property of Character Motor off!

I don't know why it does it, but it works like a charm! No jitters for me.

I hope this helps someone.

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Dealzu-The-Wikid · Jun 20, 2014 at 11:15 PM 0
Share

Disabling the character controller while on the moving platform worked while making the player a child of the platform also, its a simple solution, thank you. Remember to disable any scripts requiring the character controller component as well for those trying this.

avatar image
0

Answer by moinchdog · Jul 30, 2012 at 08:33 AM

you could just animate the Player with the Elavator and It will be forced to move with the Elavator

Dj

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by Aurelio_hl2 · Jun 04, 2013 at 10:53 PM

this works on platforms: horizontal, vertical, rotating, diagonal, up and down, animated, everything.

not affect physics, no bounce, no fall. does not affect the performance.

  • create a new java script with this.

  • added a new tag. -> "movim"

  • add this script to your character controller, or Rigidbody.

       #pragma strict
         //for Character Controller, Rigidbody, collider or more.
         //you can modify *movim* for what you want.
          var dentro : boolean = false; 
         function Start () {
          dentro = false;
         }
         function OnTriggerStay ( plataformas : Collider ){
          if(!(dentro) && plataformas.gameObject.tag == "movim"){
          this.transform.parent = plataformas.transform.parent; 
          dentro = true;
          //Debug.Log ("In");
          }
         }
         function OnTriggerExit ( plataformas : Collider){
          if(plataformas.gameObject.tag == "movim"){
          this.transform.parent = null; 
          dentro = false;
          //Debug.Log ("out");
          }
         }
    
    

alt text


elevador.png (273.1 kB)
Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by spacelizardstudio · Mar 03, 2016 at 01:26 AM

Hi, we solved this issue with a SliderJoint and by reducing the gravity scale of the character Rigidbody to 0 until he rests on the moving platform. You can find the full explanation here: http://spacelizardstudio.com/devblog/index.php/2016/03/02/unity-a-guide-to-moving-platforms/

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
  • ‹
  • 1
  • 2

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

23 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Question about pushing objects, "Animate Physics" and Rigidbodies 0 Answers

Problem with moving (animated) platforms. need script to keep player object on 1 Answer

How to have CharacterController interact with Object 1 Answer

What is the easiest way to push a character controller with a moving platform? 0 Answers

Keeping the player on a moving platform? 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges