Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 moxxv · Jan 25, 2017 at 08:08 AM · unity 5physicsplatformerplatforms

Moving a Player Along With a Moving Platform Using a Physics Material

I have a moving platform that I've applied a rigid body and physics material to so that the player moves along with the platform as it moves. I tweaked the settings so that the player is able to move at a decent speed but it's still a bit slower than when on a non-moving platform. This slow down only occurs when the player is moving in the same direction as the platform. Moving in any other direction is normal speed.

I had the idea to set a trigger on the platform so when entered, it would apply an additional force to the player to counteract the gravity and increase the speed that the player moves. It's not working and I'm not sure if it's an issue with my code or my (lacking) knowledge of physics.

 void OnTriggerEnter (Collider col){
     if (col.tag == "MovingPlatform") {
         // something to check if player is moving in the direction of platform

         GetComponent<Rigidbody> ().AddForce (transform.forward * velMultiply, ForceMode.Acceleration); 
     }

Is this possible or should I do it a different way?

Comment
Add comment · Show 3
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 SamElTerrible · Jan 25, 2017 at 08:20 AM 0
Share

Is this a 2D game?

avatar image moxxv SamElTerrible · Jan 26, 2017 at 01:54 AM 0
Share

No, its 3D.

avatar image Fenerax_Studios · Apr 09, 2017 at 05:31 AM 0
Share

I'm not quite clear but from what can make out you probably need to make a new physics material for your moving platform and set it's friction to 0, and drag it into the physic material of the platform collider. so the player doesn't slow down when on the platform.

Hope this is what you wanted, if not could you attach a picture so i can understand what is going on better.

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by Mandraker · Apr 08, 2017 at 11:20 PM

Move character with transform.translate and disable character moves for forces on the platform.

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 SeahorsePro · May 05, 2020 at 09:30 PM

Try parenting the player to the platform when they enter the platform collider and unparent them when they leave.

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

9 People are following this question.

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

Related Questions

2D 360 degress platformer example needed 0 Answers

Collision work on pc emulator but not on android device 0 Answers

Excluding Vertices from Cloth Colliders in Unity 5 4 Answers

What are the best practices when importing 2D pixel sprites 1 Answer

Ball with bounciness 1 bounces higher and higher in unity2d,Ball jumps higher and higher when bounciness set to 1 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