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 Mihaaa_123_123 · Nov 03, 2017 at 08:40 PM · 2dcollision2d-platformercollision2dcollisiondetection

Horrible Collison 2D --

Hello! So, I am making a simple platformer with basic movement (left, right, up)... I have my player (16x16 res.) with movement.cs script, collider 2d and rigidbody with mass 1 and gravity 1.

alt text

but the collison is terrible! First it goes in floor collider and than it slowly goes back.

What should i do to make it better? I already tried scaling it up but it doesnt help.

Full Movement Script:

  void Start()
 {
     rigid = gameObject.GetComponent<Rigidbody2D>();  
 }
 void Update () {
     isGrounded = Physics2D.OverlapCircle(groundCheck.position, radius,whatIsGround);
     if(Input.GetKey(KeyCode.A))
     {           
         if(-rigid.velocity.x <= speedLimit)
         {
             rigid.AddForce(Vector2.left * speed * Time.deltaTime);
         }
         //flip
         transform.localScale = new Vector2(-Mathf.Abs(transform.localScale.x), transform.localScale.y);
     }
     else if (Input.GetKey(KeyCode.D))
     {      
         if (rigid.velocity.x <= speedLimit)
         {
             rigid.AddForce(-Vector2.left * speed * Time.deltaTime);
         }
         //flip
         transform.localScale = new Vector2(Mathf.Abs(transform.localScale.x), transform.localScale.y);
     }

     if(Input.GetKeyDown(KeyCode.Space) && isGrounded)
     {
         rigid.velocity = new Vector2(rigid.velocity.x, jumpHeight);
     }


Thanks!

ezgifcom-video-to-gif.gif (364.9 kB)
Comment
Add comment · Show 7
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 MaxGuernseyIII · Nov 05, 2017 at 04:41 PM 1
Share

Someone should be able to answer this. This has to be a common problem. I guess you could consider moving this question to the help room an he see if it gets a wider audience...

avatar image MaxGuernseyIII · Nov 05, 2017 at 07:22 PM 1
Share

Do you want the elasticity at all or do you want it to be an hard surface?

avatar image MaxGuernseyIII · Nov 05, 2017 at 09:33 PM 1
Share

I cannot reproduce this. Do you see it on all collisions or just that platform? Can we get screen shots of the settings for the colliders/rigidbodies/etc?

avatar image Mihaaa_123_123 · Nov 06, 2017 at 07:14 PM 0
Share

alt text Player

1.png (58.4 kB)
avatar image Mihaaa_123_123 Mihaaa_123_123 · Nov 06, 2017 at 07:15 PM 0
Share

¸alt text

Floor

2.png (38.0 kB)
avatar image MaxGuernseyIII · Nov 07, 2017 at 01:49 AM 1
Share

I can't see anything obviously wrong and we're not attracting others to comment so we just have to go into basic diagnostic mode: start executing experiments in an attempt to narrow down the problem.

Experiments I can imagine:

  • Start turning off scripts - even ones that seem unimportant.

  • Start trying to reproduce this in a fresh project by copying what you think are the $$anonymous$$imal set of assets into it.

  • Build parallel objects to the ones that have a problem from scratch.

You know your game better than I do so it seems like you're going to be able to invent more experiments but I will say that one person I tried to help with an inexplicable-see$$anonymous$$g problem did actually find out that it was something to do with their project settings. I don't know if that person just copied everything into a new project or hunted down the setting that was the problem but even knowing that's what it was helped.

The moral of that story is don't rule anything out until you have empirically ruled it out of bounds.

avatar image Mihaaa_123_123 MaxGuernseyIII · Nov 08, 2017 at 02:53 PM 0
Share

Thanks! I"ll try experimenting... If I find out anything I will post an answer!

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by MaxGuernseyIII · Nov 04, 2017 at 05:06 AM

This is a wild guess but have you played with interpolation, at all? It seems like it's exactly for this and their recommendation was specifically to have it be turned on for the main character and off for everything else.

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 Mihaaa_123_123 · Nov 05, 2017 at 12:14 PM 0
Share

Already tried that... Both extra and interpolation... Same issue.

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

173 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

Related Questions

OnTriggerEnter2D and OnCollisionEnter2D not working 1 Answer

Tilemap Collider problems 0 Answers

Circle Collider2D Stuck ob Box Collider2D at the corner :( 0 Answers

Can't make the player attack an enemy 0 Answers

2D collision not working 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