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 Helpmepls123 · May 20, 2010 at 07:02 PM · animationsmovingplatformshorizontal

How to compensate for moving platforms that move side to side

Question 694

I followed the exact way that was described in the link. It works great with vertical moving platforms. However, when I got my character to a platform that was moving side to side, the character didn't move with the platform. Is their a way to compensate for this?

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

Answer by Deo · May 21, 2010 at 01:18 AM

I got the simplest solution for this problem from another forum.

So basically, you create another object with collider on top of your normal platform, and parent it to your platform.

Apply this script to your collider object, and it should work.

function OnTriggerEnter (other : Collider) { other.transform.parent = gameObject.transform; } function OnTriggerExit (other : Collider) { other.transform.parent = null; }

Comment
Add comment · Show 2 · 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 Helpmepls123 · May 27, 2010 at 07:08 PM 0
Share

Sorry for the late response, but I tried that and it just makes my character fall through the platform.

avatar image Helpmepls123 · Jun 02, 2010 at 06:47 PM 0
Share

Ok I did something wrong. It works now but the problem I have is that when my player turns around, he just randomly disappears and the Character Controller keeps changing in size. What's going on?

avatar image
1

Answer by jamesster · Sep 27, 2010 at 09:33 PM

Create an empty GameObject. Add a mesh collider in the shape of your platform, and make it a trigger. Then make it a child of your platform/elevator (it works for both), and raise it so it is just a little higher then the platform itself. Then attach this script to the trigger you made:

var Player : Transform; var Elevator : Transform;

function OnTriggerEnter (other : Collider) { Player.parent = Elevator; }

function OnTriggerExit (other : Collider) { transform.DetachChildren(); }

Make the trigger GameObject in the Elevator slot and your player in the Player slot. When your player gets on the moving platform, he/she will not slide off and will move with the platform perfectly in any direction.

Comment
Add comment · Show 5 · 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 angad singh · Oct 25, 2010 at 09:03 AM 0
Share

my question was the same, and i tried this answer, but! my character moves with the platform (i have rotating platforms) even when in the air!!! any ideas?

avatar image dre38w · Dec 06, 2010 at 03:57 PM 0
Share

I'm having the same issue and it didn't work at all. The player still slides off. I've tried many methods. Putting a CharacterController on it and messed with some methods that included that, messed with the Trigger method, and different versions of the parenting method. Nothing's working.

avatar image dre38w · Dec 06, 2010 at 04:01 PM 0
Share

Just to make sure I wasn't too confusing when I said "it", the CharacterController was put on the player not the platform.

avatar image Sinron · Oct 12, 2012 at 02:03 AM 0
Share

I'm also having this issue. It's a real pain and cannot figure out how to make this smooth connection between moving platforms and the player.

avatar image Tekksin · Oct 30, 2013 at 06:15 PM 0
Share

Nice, but my character slightly follows the motion of the platform. the player still falls off, but follows the platform as it moves very slightly. Is there a reason for this?

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

3 People are following this question.

avatar image avatar image avatar image

Related Questions

Moving Platforms + Third Person Controller 0 Answers

Moving an object between two positions (C#) 1 Answer

How to make character "stick" to moving platform? 2 Answers

Broken animations 1 Answer

2D Platformer Moving Platform Question 3 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