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 Rezzel · Jan 05, 2014 at 04:17 PM · 2dunity 2d2d-platformerplatformermechanics

2D Platformer queries

I got excellent help in my last question so I decided to throw two more questions up in hope for a similar reaction!

How would I go about making it so certain surfaces cause a loss of friction, (example a slippery surface which makes it difficult for the player to direct themself, but not a total loss of control)

How would I make a gravity lift type mechanic? Like the player walks into say a wind turbine pointing upwards and it pushes the player upwards to a different point of the map?

Is there any way to do this, like a script I can input, or an easy explanation? I'm quite new to unity. All help is appreciated :)

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

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Cowsmanaut · Mar 05, 2014 at 08:55 AM

There is a physics material2D which you can import by right click in your assets and Create> this can then bet dragged to any collision object to allow you to assign a friction and a bounce factor to collision objects. I've managed to make the bounce work just fine, but the friction appears to do nothing. Might be me, or might be a bug.

for the hover, there is a tutorial in the learning area for this as a 3D thing, but you need only change the elements to the 2D variants of the same commands..

 public Vector2 hoverForce;
 
     void OnTriggerEnter2D (Collider2D other)
     {
         other.rigidbody2D.velocity = (hoverForce * Time.deltaTime);
     }

edit: I continued to play with this, and discovered the issue with the friction is that the 2D friction will not work if you're using rigidbody2D.velocity, but will work if you use rigidbody2D.addForce. The difference between the two, is that the addForce will gradually build as you move, where as the velocity is more immediate.. So, if you want to use both, my suggestion is to make an exception to your character that when they are touching a slippery surface, move with addForce and when not, use velocity. :) seems to be working for me.

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

19 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

Related Questions

Multiple Cars not working 1 Answer

Unity 2D player sticks on platform corners 2 Answers

jittery collisions 2d platformer 1 Answer

Help with a 2d camera Controller 1 Answer

Im trying to make it so it limits jumps in my 2d game. But when I play it, It only jumps once then your not able to jump again. Anyhelp? I need a answer fast because this is for the blackthornprod game jam 2 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