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 speedb · Dec 15, 2010 at 09:45 PM · mathfloatjointconfigurablejointround

"bleeding" when using configurable joints

Hi, I have a scene with some objects (cubes and/or spheres for that matter) falling down in 2D (XY plane). I Locked the Z motion and checked "configured in world space", and it does seem to work - however there is a strange "bleeding" problem on the Z axis - the Z position changes - but with very small numbers ( -3.312148e-06 and so). Anyone knows why this happens?

Comment
Add comment · Show 2
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 Statement · Dec 15, 2010 at 10:30 PM 0
Share

I feel this is related. $$anonymous$$aybe it can serve to help you a bit. http://answers.unity3d.com/questions/31877/limiting-physics-to-x-and-y/31879

avatar image speedb · Dec 16, 2010 at 07:46 AM 1
Share

I created a small demo scene to replicate this "error" - now in this one the Z drift is ranging between e-3 and e-6 - to all objects. I locked all moving objects with Z motion and angular X and Y motions. Drag and Angular Drag are set to 0. If anyone is interested - it can be downloaded from : http://www.speedboxtech.com/test4.zip (390$$anonymous$$B)

2 Replies

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

Answer by Proclyon · Dec 15, 2010 at 10:00 PM

Yes I am 100% sure of it aswell!

Floating point values are rounded

I am not sure if you are familiar with scientific decimal notation, please don't be insulted if I do explain, I just can not assume you do :)

-3.313148 * 10 ^ -6 just means the point moves 6 to the left -0.....and so on 3313148

ea

VERY VERY VERY small number

In astronomy this is very common where values are beyond your and my imagination and such notations are not even a choice (Even lightyears really aren't that big). Otherwise you would just run out of paper and pens.

This rounding value is done automatically. You just need to ignore it. The value is infinitesimal and will not have any effect. But I am not 100% sure it will pass a value = 0.0f check. You could check. If so just have a minimum domain of -0.00001f and a max of 0.00001f and clip every 0 measurement between that for the same effect.

EDIT:

That changes everything (see below comments). I can only speculate on the cause as your question mentions. Possibly drag on triangles ( wind will always have an effect on triangles with their flat surfaces, no matter how small you make them to build a sphere. 0.001 is definatly not a value to simply be brushed away as irrelevant in this situation I believe. If not so I would never blame rounding on a value this large at least. Well I don't have more answers. But I have an idea. Script a Z-Clip script like I did for rounding. Make the domain between whatever you find acceptable and FORCE the object to always remain in that position by nudging it back.

Comment
Add comment · Show 11 · 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 Statement · Dec 15, 2010 at 10:41 PM 0
Share

Number rounding alone doesn't really explain why it'd drift in Z though. What am I missing? You seem pretty confident about your answer. Things like these bug me all the time.

avatar image Proclyon · Dec 15, 2010 at 10:50 PM 0
Share

$$anonymous$$y apoligies if that offended you, I got a bit excited, I usually doubt answers to the point of brutal scrutiny, particularly my own. The movement I can not explain without understanding the causes of the motion. The number changes however on that small scale are (even if my answer is not correct) not of any effect to the object. $$anonymous$$aybe it could help to see if this occurs on specific parameters alone. Such as having a rigidbody or not.

avatar image Proclyon · Dec 15, 2010 at 10:53 PM 1
Share

Well , logically speaking , if you drop an object in a normal physics environment ( non - virtual ) can you expect it to fall down without having the slightest of course changes? Is there some drag applied? If so a non perfect sphere will have a millionth or so difference depending on the triangle amount it consists of will causes Z changes during the drop. Since you can not make a perfect sphere with triangles and current technology in any case, just mimic it to a depth of accuracy where it becomes far less relevant.

avatar image speedb · Dec 16, 2010 at 06:06 AM 0
Share

Yes, I know it is a very very small number but I was under the impression that when Z motion is locked, it will lock it to 0 without even the smallest drift..

avatar image Statement · Dec 16, 2010 at 01:30 PM 1
Share

@Proclyon "$$anonymous$$y apoligies if that offended you" > No, not at all. I just realized I don't know whats going on and since you said you were 100% sure why, I thought I wanted to know more. That's all :) I actually upvoted you. Your next comment is great in the sense that we shouldn't expect the world to be a perfect model, since it is way more complicated than we can model in a simulation. I couldn't agree less. It's a great way to accept the fact. However, for this particular case where we want to reduce one dimension and go 2D, it would actually help to ensure that Z movement is perfectly locked.

Show more comments
avatar image
1
Best Answer

Answer by Statement · Dec 15, 2010 at 10:38 PM

I can't explain it. There shouldn't be anything modifying the Z component given the Z starts in 0, and is falling without any velocity or force in Z. It just shouldn't happen. I doubt it is rounding alone because even operations like normalizing the velocity would set Z to 0, since it was 0 to begin with. 0 / whatever is always 0. I think it might be something with the joints code that attempt to maintain its position. Or it can be rotational forces acting on it.

I don't know if this fix or breaks anything for you but you can try manually setting z to 0 in FixedUpdate.

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 speedb · Dec 16, 2010 at 07:42 AM 0
Share

I thought about manually setting the Z to 0, but was unsure how it will impact on performance .. if it's going to be 3.6e-6 it might be ok :)

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

1 Person is following this question.

avatar image

Related Questions

Is it possible to round down 0.99 to 0? 2 Answers

Float to Int 4 Answers

Configurable joints rotating at a certain angle 2 Answers

Is there a way to rotate the anchor of configurable joint? 0 Answers

Maths issue + Null reference error? -1 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