• 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
2
Question by runonthespot · Feb 08, 2011 at 01:19 PM · physicsios

Deterministic physics, same platform

I'm aware that unity physics aren't deterministic on different platforms, but what about a consistent platform like IOS? When answering this question, please can you confirm whether this applies to the latest Unity engine (3 at this point) or whether it is information gleaned from older posts.

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

5 Replies

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

Answer by taoa · Feb 08, 2011 at 02:36 PM

I would be very wary of basing my project/application on the assumption that physics are deterministic, even on a given platform. For if it eventually reveals to be untrue, if you believe 'some guy on the internetz who told you it was', you'll end up with a massive problem on your hands.

In your situation, I'd assume that it isn't and build your project on this decision.

Plus, in physics engines, there's no telling when one person's machine might do a little error and end up being out-of-sync after a check.

Comment
Add comment · Show 2 · 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 runonthespot · Feb 09, 2011 at 10:05 AM 0
Share

I guessed as much.

avatar image xdarned · May 01 at 08:46 PM 0
Share

I can provide proof that physics are not deterministic even in the same platform. In the scene I have a copy of a structure using hinge and fixed joints. Both structures have the exact same configuration, though both of them behave very different to each other when running the simulation.

https://www.youtube.com/watch?v=xV0gUL1qxJ4&ab_channel=StanKeyal

avatar image
1
Best Answer

Answer by Bunny83 · Feb 08, 2011 at 04:37 PM

Beside the hardware limitations like floating point precision that will accumulate over time there are some things, even in the "real" world, that can't be calculated/determined.

Best example the double pendulum.

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 runonthespot · Feb 09, 2011 at 10:06 AM 0
Share

double pendulum is incredibly fascinating! That said, my constraints are simpler, it really is just unpivotted collisions, but I can't see how I'll ever avoid needing to keep things synced.

avatar image
1

Answer by Ashkan_gc · Nov 11, 2013 at 12:08 PM

Unity physics is not deterministic even in the same machine. You can disable coan friction and do some other tricks to make it more deterministic but at the end it's not at all.

We tried to make a replay based on physX but could not because of this fact.

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
avatar image
0

Answer by teslatron · Oct 31, 2014 at 02:18 PM

We made Unity physics deterministic between Windows running PCs'. It was not deterministic even on the same machine at first but after making tremendous tests we finally made a setup that is almost deterministic. I say almost because we still not able to make it cross-platform deterministic. But I may say it is fully deterministic between PC-Windows machines.

Our findings to achieve windows platform determinism:

Magical Settings:

  • Rigidbody.useConeFriction = false

  • Make extreme caution to not to overlap or pass-through colliders in the scene. Only physics engine should handle collisions and transform operations.

For all rigidbody objects in the scene:

  • Rigidbody Collision detection = Discrete

  • Rigidbody Interpolate = None

And when moving physics objects by code, we came up with this, make sure it is called in FixedUpdate():

 IEnumerator SyncCallback()
 {
     if (rigidbody.isKinematic == false)
     {
         rigidbody.velocity = Vector3.zero;
         rigidbody.angularVelocity = Vector3.zero;
     }
 
     rigidbody.isKinematic = true;
 
     yield return new WaitForFixedUpdate();
 
     rigidbody.position = mSyncData.Position;
     rigidbody.rotation = mSyncData.Rotation;
 
     yield return new WaitForFixedUpdate();
 
     State = mSyncData.State;
     rigidbody.isKinematic = false;
 }






Comment
Add comment · Show 3 · 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 JoeOfTex · Nov 10, 2014 at 10:28 PM 0
Share

What data are you using in mSyncData?

avatar image teslatron · Nov 11, 2014 at 02:09 PM 0
Share

SyncData is basically:

 public Vector3 Position    { get; set; }
 public Quaternion Rotation { get; set; }

avatar image alonsoGarrote · Apr 22, 2016 at 06:40 PM 0
Share

Hi teslatron, Can you explain how this cod works?, I see this make rigidBody kinematic for a short time so you can change its position and rotation by code, then after a short time rigidBody isnt kinematic anymore. How do you get that input data, mSyncData.Position, mSyncData.Rotation?, and what does this line means: State = mSyncData.State; ?, Im trying to do a GunBound Style game on mobile BTW. Regards

avatar image
0

Answer by jpthek9 · May 09, 2015 at 12:24 AM

Yes! But not by default. Here's my implementation that will be on the Asset Store: http://redd.it/358hl6.

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

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

60FPS constant, but serious visual stutter - only on iOS 1 Answer

Can Achieve Deterministic Physics ? 1 Answer

Colliders ignoring each other on iOS? 1 Answer

Create 'Tippex' for a drawn line. 1 Answer

Creating Physical Border around Edges of Device Screen 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