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 /
  • Help Room /
avatar image
0
Question by wittledemon · Aug 27, 2019 at 09:52 AM · collisioncolliderspritejitter

[Problem]Collider Issues when Sprites Meet

I fairly certain this has been asked before but not sure what to google to get correct information.

I have a collider that when I jump and it collides with another collider that sometimes not always it bleeds into the sprite it collides with. Could someone direct me as to how to fix this issue please?

I currently tried a few methods but none worked or they created other issues I was not satisfied by for instance:

  1. Placing my jump method into the Fixed update Method as I did with my movement to stop the jitters of the collision. However, this had no effect.

  2. Making the collider it was connecting with larger in the y position. However, this one had the effect of walking on nothing by the time I got it big enough to stop the bleeding effect.

In case code is needed:

     private void Jump(bool jump)
     {
         //if rb velocity = 0 and jump = true
         if (rb.velocity.y == 0 && jump)
         {
             //rb velocity = upward at a specivied jumpSpeed
             rb.velocity = Vector2.up * jumpHieght;
         }
         JumpStates();
     }
     private void JumpStates()
     {
         //if velocity < 0
         if (rb.velocity.y < 0)
         {
             //velocity += up * gravity * highJumpFallSpeed * delta
             rb.velocity += Vector2.up * Physics2D.gravity.y * (highJumpFallSpeed - 1) * Time.deltaTime;
             //spriteAnimation change isJumping true
             animationState.SetBool("isJumping", true);
         }
         //if velocity > 0 and jump false
         else if (rb.velocity.y > 0 && !Input.GetButton("Jump"))
         {
             //velocity += up * gravity * highJumpFallSpeed * delta
             rb.velocity += Vector2.up * Physics2D.gravity.y * (lowJumpFallSpeed - 1) * Time.deltaTime;
             //spriteAnimation change isJumping true
             animationState.SetBool("isJumping", true);
         }
         else if (rb.velocity.y > 0)
         {
             //spriteAnimation change isJumping true
             animationState.SetBool("isJumping", true);
         }
         else
         {
             //spriteAnimation change isJumping false
             animationState.SetBool("isJumping", false);
         }
     }

 

Comment
Add comment · Show 1
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 I_Am_Err00r · Aug 27, 2019 at 01:15 PM 0
Share

Show me the gameobject in your scene window with it's collider shown; it sounds like a collider issue not a code issue.

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by wittledemon · Aug 27, 2019 at 04:56 PM

Players Collider is first and the object collider is second.

alt text

alt text


player.png (13.6 kB)
player-collider.png (30.9 kB)
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 I_Am_Err00r · Aug 27, 2019 at 05:11 PM 0
Share

Show the player object in the scene window please, not the inspector; I'm trying to see if you need to resize your collider on the player

avatar image
0

Answer by I_Am_Err00r · Aug 27, 2019 at 06:42 PM

Your collider does look a little short on the top, I would ensure that everything is outside of the collider, but it looks setup correctly honestly.


Let me help you out by giving you a script that will check for ground, if grounded allow you to jump; if you want that just reply to this comment and I will share and explain it with you; I honeslty don't understand a lot of the if statements in you script and would prefer to just write something up for you because it will work and require much less back and forth.

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 wittledemon · Aug 27, 2019 at 11:50 PM 0
Share

It actually was the code that was the problem I reworked the code out piece by piece and found my mistake its smoothed out now and lot lighter on the code. Thanks for the assistance.

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

277 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 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 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

How do I change the look of an object in my game? 0 Answers

Character Controller jittering with other colliders 0 Answers

Having the worst time making OnCollision work... Strange. 0 Answers

Opening a door with OnCollisionStay 2 Answers

2d box collider not working (have rigid body) 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