Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • 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
0
Question by IronWarrior · May 21, 2010 at 10:00 PM · charactercontrollerplatformerpushmoving-platformmove-with-moving-platform

Make a Platform push a character controller?

Hi, I'm looking for a way to make an object with a collider attached be able to "push" a character controller along without the controller just sliding through it. This is mostly for moving platforms and the like.

Getting a character to stand ontop of a platform and move along with it is fairly easy; my problem is when the platform floats horizontally into the character controller and just "passes" right through him. I can't use OnControllerColliderHit because if the controller isn't moving then it doesn't register the collision...kinda lost here, would appreciate any kind of solution for this or direction I could go to accomplish it.

Thanks you for any help.

Comment
Add comment
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

2 Replies

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by spinaljack · May 22, 2010 at 01:34 AM

This question has been answered already if you take a look at the search function.

You want to test for collision with the character controller and then edit the character's transform.position directly with the relative position of the moving platform.

Comment
Add comment · Show 4 · 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 IronWarrior · May 22, 2010 at 07:08 AM 0
Share

How would I test collision with the controller if he's not moving (ie: the controller is static and the platform is floating horizontally into him) because OnControllerColliderHit only triggers when the character is moving...or is there another way to check it?

Thanks for the answer

avatar image spinaljack · May 22, 2010 at 10:16 AM 0
Share

You can place a trigger all around your moving platform with a rigid body (either the platform or the character needs one for collision to be detected) and use OnTriggerStay to perform your logic.

avatar image spinaljack · May 22, 2010 at 10:17 AM 0
Share

Also, no collisions are detected on a rigid body that's sleeping so you might want to call Awake() on it to make sure it's no sleeping

avatar image IronWarrior · May 22, 2010 at 06:20 PM 0
Share

Alright, think I got it to work! Thanks very much!

avatar image
0

Answer by carlos.castaneda · Jan 22, 2013 at 05:26 AM

In platform-character behavior I prefer to parent the player to the platform, this allow to inherit the translational movement of the platform to the player and even allow the player to move and jump above the platform without any problem.

the platform must have a collider and a trigger (the trigger should have the parenting script)

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

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.

Follow this Question

Answers Answers and Comments

1 Person is following this question.

avatar image

Related Questions

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

CharacterController falls through or slips off moving platforms 2.0 2 Answers

moving platform jumping and then continuing it's path 0 Answers

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


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