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
1
Question by Rphysx · Apr 16, 2014 at 12:03 PM · bounceshakerigidbody 2dsimple fix

On Collision 2D object continuosly bounce/shake

So I basically have two gameobject with a boxcollider2D attached to it, one is a static wall without rigidbody and the other is let's say the player that I scripted to move using transform.position.

Apparently the object goes inside the wall's boxcollider and return to the previous position generating thus that orrible shake i'm trying to fix.

A possible solution would be using ray/linecast and would be fine to solve it that way but is there any other workaround for this problem ? I read that providing forces to the player instead of moving it with transform would be better and may fix this, but how ? What's the difference ?

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

2 Replies

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by jonSG · Apr 16, 2014 at 01:11 PM

The difference at a high level is the "force" / "physics" method applies a "push" that shoves your object. Think "Angry Birds" or a game of shuffleboard or darts. When you update transform.position it is more like teleporting the object rather than pushing it.

The bounce you see might be the collider and your teleportation fighting it out to find a position for your object if every frame you are attempting to teleport inside one.

It can be a challenge to convert teleportation based movement into force based movement and have something that "feels right".

One thing you can try that is easier than application of force and is much closer to updating your position is to set the velocity vector on your object rather than the position.

Comment
Add comment · Show 4 · 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 Rphysx · Apr 16, 2014 at 01:37 PM 0
Share

thanks for the answer, do you know valuable examples/documentation on how to apply vectorial velocity on 2d/3d objects to update the position?

avatar image jonSG · Apr 16, 2014 at 01:47 PM 0
Share

If you check out the "character controller tutorial", I think the motion is done via setting velocity:

avatar image Rphysx · Apr 16, 2014 at 01:53 PM 0
Share

Quick fix : I used the rigidbody2d.velocity property and i'm setting it via a vector3 vector. No bounciness but I need to do a double check in update() (onkeydown & onkeyup ins$$anonymous$$d of just Getkey) is this what you were referring to vectorial movement ?

avatar image jonSG · Apr 16, 2014 at 02:05 PM 0
Share

Ya, glad it helped,

If you wanted to, you could probably still use getkey if you multiply the velocity by Time.DeltaTime or set the velocity in FixedUpdate() rather than Update()

avatar image
0

Answer by WilldD · Oct 09, 2020 at 12:41 PM

In my case, one of the two colliders had a high bounciness material. Removing the material fixed the issue 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

22 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

Related Questions

Make camera blurry/shaking when enemy gets close 1 Answer

How can you grab an object on the screen and shake it? 0 Answers

how to make camera shake when on collision with certain object 0 Answers

how can i fix NSIS error in intall unity 4.3.0? 0 Answers

Creating a bounce effect? 3 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