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
0
Question by samanime · Jun 19, 2015 at 03:56 AM · physicsrigidbodyrigidbody2dphysics2d

Stack of RigidBody2D, Freeze X and Z, Odd Behavior

I have a prefab I call "Tile", which has Sprite, BoxCollider2D, and RigidBody2D. I also have another object I call "Base" which has Sprite and BoxCollider2D.

There is nothing special about Sprite or BoxCollider2D, just the defaults with my image.

The RigidBody2D on Tile has Freeze X position and Freeze Z rotation.

I have 5 tiles stacked vertically on top of each other (in a column), with Base under them to catch them. The 5 Tiles and 1 Base are also in an empty Game Object called Board, for grouping.

The idea is that the 5 fall on top of each other, only in the Y direction, and pile up on Base and each other.

This mostly works as expected except for one thing: one of the Tiles (which is largely random) kind of gets sucked to the center of Board (if Board has an X of 1.6, the Tile gets an X of -1.6, etc). Even if I try to move it while the game is running (via the Scene tab), it just gets pulled right back there. If any other Tiles touch it, they also get vacuumed to this spot.

There are no other scripts or anything that could be interfering. I don't even have any scripts that use anything related to the physics in the project yet. The closest I have is using Transform to simply get children objects for things like setting the text of a Text object.

Any ideas?

Quick update: Interestingly, if I set them to Is Kinematic, the one still gets pulled to the middle. Also, if I remove Freeze X, one does not get pulled to the middle.

Update 2: It appears to only do it sometimes. It does it more often than not, but when if I sit there and turn the play test on and off a few times, sometimes it won't do it. I thought overlapping pieces may play a part, but even when I space them substantially apart, they still may do it. I'm wondering if this isn't just a Unity bug.

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

Answer by NordSpirit · Dec 22, 2015 at 05:24 PM

Hello, I stack with a same things, if you checked freeze position x, sometimes it pull to the center of the scene. I think this is bug or something. So I Just make script that take x.position of my game object on x axis, and place it on FixedUpdate.

Vector3 ert = this.transform.position; ert.z = 0.0f; ert.x = 0.0f; transform.position = ert

P.S. I know that is not best way to solve this problem, but it's work. @samanime

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

increasing knockback of a rigidbody as received damage increases (like super smash) 1 Answer

How to make physics relative to moving parent 1 Answer

Rigidbody2D: Follow other Rigidbody2D strictly 1 Answer

Inconsistent gravity/random forces/solver problem? (forum crosspost) 0 Answers

Recalculating collisions after Physics2D.IgnoreLayerCollision()? 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