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 kotasugi2007 · Jan 20, 2020 at 10:49 PM · 2dplatformer

How to do wallJump (Celeste-Movement Mix and Jam)

Hello, I need help. I have no idea how to fix this bug. The bug is every time I tried to do a wall jump it doesn't let me do, but when I do wall jump while grabbing or the position I jumped is next to wall it works. This is the code * private Rigidbody2D rb; public float speed = 10; public float jumpForce; public float slideSpeed; public float wallJumpLerp = 10; public float dashSpeed = 20; private Collision col; public bool canMove; public bool wallGrab; public bool wallJumped; public bool wallSlided; public bool isDashing; public int side = 1; // Start is called before the first frame update void Start() { rb = GetComponent<Rigidbody2D>(); col = GetComponent<Collision>(); } // Update is called once per frame void Update() { if (col.onGround) { wallJumped = false; } float x = Input.GetAxis("Horizontal"); float y = Input.GetAxis("Vertical"); Vector2 dir = new Vector2(x, y); Walk(dir); wallGrab = col.onWall && Input.GetKey(KeyCode.LeftShift); if(wallGrab) { rb.velocity = new Vector2(rb.velocity.x, y * speed); } if(col.onWall && !col.onGround) { if(x != 0 && !wallGrab) { wallSlide(); } } if(Input.GetButtonDown("Jump")) { if(col.onGround) { Jump(Vector2.up, false); } if(col.onWall && !col.onGround) { wallJump(); } } } private void wallSlide() { rb.velocity = new Vector2(rb.velocity.x, -slideSpeed); } private void Walk(Vector2 dir) { if(!canMove) return; if(wallGrab) return; if(!wallJumped) { rb.velocity = (new Vector2(dir.x * speed, rb.velocity.y)); } else{ rb.velocity = Vector2.Lerp(rb.velocity, (new Vector2(dir.x * speed, rb.velocity.y)), .5f * Time .deltaTime); } } private void Jump(Vector2 dir, bool wall) { rb.velocity = new Vector2(rb.velocity.x, 0); rb.velocity += dir * jumpForce; } private void wallJump() { StartCoroutine(DisableMovement(0)); StartCoroutine(DisableMovement(.1f)); Vector2 wallDir = col.onRightWall ? Vector2.left : Vector2.right; Jump((Vector2.up / 1.5f + wallDir / 1.5f), true); wallJumped = true; } IEnumerator DisableMovement(float time) { canMove = false; yield return new WaitForSeconds(time); canMove = true; } I know this may be confusing but I need help. And anyone who wants to check the video here is the link : https://youtu.be/STyY26a_dPY

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
Best Answer

Answer by logicandchaos · Jan 21, 2020 at 05:05 AM

Hey you need to put your code in tags or something, can;t read it like this. But to answer your question I discovered a simple way how to making my current game. I just realized it might not work if you are using unity gravity, I set gravity in my project to 0 so that I could implement my own gravity, for more control. I use two collision boxes for my character one for my 'body' hit box, the other on the bottom just for detecting the ground. I have a grounded state on my characters and if they are not grounded then I apply gravity downwards, or any direction I want.. So the ground hit box has OnTriggerEnter sets grounded to true, OnTriggerExit sets grounded to false. I have my walls tagged as ground aw well, but you can set it up other ways. so all you have to do to have wall climbing is make your ground box collider a little wider than then body collider. Then if you have body a little wider than the ground one your character won't be able to wall climb. So you could control the wall jump ability with the width of the ground collider box. I hope that helps.

Comment
Add comment · Show 1 · 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 kotasugi2007 · Feb 08, 2020 at 09:43 AM 0
Share

I had already solved, but thank you for the reply

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

118 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 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 2d platformer "Foot effects" is not in Character prefab? 0 Answers

Pause button triggers a jump. 1 Answer

How to check for the ground in Unity 2D for Jumping 1 Answer

Having trouble moving object in opposite direction of player. 1 Answer

How do I use RayCast in a 2D Platformer game? 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