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 spark-man · Sep 08, 2015 at 08:45 PM · physicsbugperformancerigidbody2dphysics2d

Why Rigidbody2D gameobject automatically translating to Vector2.zero itself

Hi all.

Mystery bug occurs once a while. I mean my project work perfectly as i need at most of times.

In my scenario, Series of rigidbody2d ball is shooted by using Ball_Rigidbody2D.AddForce(dir*speed); .

Ball usually hits the wall and bounce little bit, then falls down on floor.

But in rare case when it hits wall it automatically translate to Vector2.zero itself

If i leave it to occur in loop then it will hit very bad Physics2D.Simulate in Profiler. Later lags like hell.

please watch this video to get clear idea on bug: https://youtu.be/JjdcydDKHMA

Im noob but Im aware of few basics physics rules that rigidbody should not be translated via script. If isKinematic is enabled we can translated via script.

I googled a lot to solve this issue, but sadly didn't found any solution. Please help me to fix this bug.

Thank you in advance :)

Comment
Add comment · Show 3
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 hexagonius · Sep 08, 2015 at 09:07 PM 0
Share

Is collision detection code involved (OnCollisionEnter2D)? how are you moving the rigidbody? is it's position altered somewhere in the code?

avatar image spark-man hexagonius · Sep 09, 2015 at 05:57 AM 0
Share

sorry for late reply. Thank you for responding.

Yes OnCollisionEnter2D is involved. but no problem there

 void OnCollisionEnter2D(Collision2D collision) {
         if(firstTime == true)
         if(collision.gameObject.tag == "Player" || collision.gameObject.tag == "Floor")
         {
             ExplodeNow();
             firstTime = false;
         }
     }

Im instantiating ball at a point and moving by applying force on ball once using Ball_Rigidbody2D.AddForce(dir*speed);

avatar image spark-man hexagonius · Sep 09, 2015 at 07:24 AM 0
Share

Ohhh no is$$anonymous$$inenatic enabled gameobject also automatically translating to Vector2.zero itself

im noob, I may did not obey unity laws of physics, so let me explain how did i implemented.

  1. Falling (bomb) ball is Rigidbody2D, driven using Rigidbody2D.AddForce(dir*speed);

  2. Square Sprite (Cat) is is$$anonymous$$inematic enabled, i'm controlling it using Rigidbody2D.$$anonymous$$ovePosition(Vector2);

  3. Bullet from Cat is is$$anonymous$$inematic enabled, i'm controlling it using Rigidbody2D.velocity = Vector2.up*speed;

First i implemented in 3D with this same script, but this bug didnt showedup

please say whether i used anything wrong. thank you in advance :)

1 Reply

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

Answer by spark-man · Sep 10, 2015 at 01:13 PM

Its unity engine bug. It is fixed after updating to latest version Unity 5.2.0 f3

A guy from Unity Technologies said me in forum.

http://forum.unity3d.com/threads/why-rigidbody2d-gameobject-automatically-translating-to-vector2-zero-itself.353595/

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

3 People are following this question.

avatar image avatar image avatar image

Related Questions

Rigidbody2D freezes 0 Answers

how to make my character stay stable after hit? 2 Answers

About Rigidbody2D.AddForce's duration... 2 Answers

Collision 2d is not working perfectly 0 Answers

Workarounds for Higher Control When Using Physics2D? 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