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 /
This question was closed Jan 16, 2019 at 09:09 PM by frontlinesaint.
avatar image
0
Question by frontlinesaint · Jan 14, 2019 at 11:44 AM · unity 2djumpingwall jump

trying to get a good wall jump for my 2d game

I am new to programming who was to know wall jumping could be so hard lol.

What i need is when my player jumps on a certain wall, he jumps from side to side with added force like a dash or something and can only jump left to right or vise versa. I also need him to slide down the wall when jump button is not pressed.

Probably a annoying question but you got to start somewhere. Has any one got an idea how i can achieve this?

Any help would be great as i am not to sure how i can do this. P.s im new so if my code bad dont judge me haha.

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

  • Sort: 
avatar image
0
Best Answer

Answer by mlnczk · Jan 14, 2019 at 02:18 PM

Ok so there is few things you can upgrade and think about to achieve what you want. Im not gonna do everything for you since it wont teach you much but I can give you ideas to solve your problem. First and foremost you are using Update method. This isnt correct. Whenever you touch rigidbody behaviour it has to be in FixedUpdate method it has better frequency calculations when it comes to physics. If you want your character to slowly slide down the wall whenever player dont jump but touches the wall you can consider changing player's rigidbody's gravityscale. Eg below: private void OnCollisionEnter2D(Collider2D collision){ if(collision.CompareTag("Wall")){ rb.gravityScale = -10f; //have fun changing value and adapting to your needs } }

 private void OnCollisionExit2D(Collider2D collision){
    if(collision.CompareTag("Wall")){
        rb.gravityScale = 1; // should be default value
     }
 }

About jumping. Google and look for Spline Tools. You can find really nice spline assets completly for free. They allow you to move objects following lines. You can curve them do whatever you want and its pretty simple. You can Set on both sides on top of wall empty colliders and check if player's collider is InTrigger with one of those - right or left and then allow player to press second jump action to do the jump. If player leaves the trigger collider he cant jump anymore. When it comes to jump method itself. Spline should do the job. Just make player move following spline curved above wall tip until it lends at the end of it on the other side. You can also consider just simple animation and just play animation but it might be buggy and for sure less optimised. Anyways good luck!

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

Follow this Question

Answers Answers and Comments

101 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 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 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 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 avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Why isn't my player looking the other direction when I wall jump (please help I am desperate) 1 Answer

How to fix the vibration while colliding and the suspension after jumping? 0 Answers

when attempting to jump my player shoots into the air and disappears. can someone help? 0 Answers

Unity 2D: Variable Jump Height with a Double Jump 0 Answers

How to implement a jump in 2D unity like in Mario and Luigi Superstar Saga? 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