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 Reddoge · May 14, 2018 at 04:05 AM · physicseditorbuildaddforceinconsistent

How to make add force/Physics consistent between editor and builds?

I have researched and looked at all other posts with no success. I am creating a network game where a dice roll is involved, I have the server generating random floats and then sending that information to the clients that then uses those numbers for the torque and add forces. The issue is that if the client is in the editor or have different quality settings the results come out different than they are supposed to. I have tried modifying the Fixed Timed Step. If anyone has any ideas please let me know.

Note: It does not even seem to be add force most of the time, it seems to just be physics itself is inconsistent between the qualities, I understand why but I do not know how to fix this.

Code: This is being called from a FixedUpdate function.

 public void Roll(float y, float right, float up)
     {
         transform.localScale = startScale;
         transform.rotation = startRotation;
         rb.velocity = Vector3.zero;
         rb.mass = 1;
 
         rolling = true;
         isMoving = true;
 
         transform.position = startPos;
         rb.AddForce(new Vector3(0, y, 0), ForceMode.Force);
         rb.AddTorque(transform.right * right, ForceMode.Force);
         rb.AddTorque(transform.up * up, ForceMode.Force);
     }


Comment
Add comment · Show 4
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 bobisgod234 · May 14, 2018 at 06:16 AM 1
Share

Post some code examples of where you apply torque and forces.

avatar image Reddoge bobisgod234 · May 15, 2018 at 12:25 AM 0
Share

Done, Thanks

avatar image jacksonnadar123 · Jun 18, 2020 at 04:35 PM 0
Share

@Reddoge Did u find the solution I have the same issue.

avatar image jacksonnadar123 · Jun 22, 2020 at 02:53 PM 0
Share

Did you find the solution??. If you have please let me Know I have the same issue.

1 Reply

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

Answer by ImpOfThePerverse · May 15, 2018 at 12:59 AM

The most reliable solution would probably be to record the dice rolls as animations, then play back the appropriate animation based on the output from a random number generator. I don't think the physics engine will ever be entirely deterministic to that degree, since it relies on precise timing and order of execution. There was something on the asset store that could record gameplay to animation files, but it looks like it's been taken down. It's pretty easy though to write a script that records transform data to a file at regular intervals (every 60th of a second or whatever), then another script to read the recorded transform data and apply it to your dice.

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

167 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 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 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 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 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 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 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 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

Distribute terrain in zones 3 Answers

Physics Raycast work fine but don't work after build game. 0 Answers

addforce seems inconsistant 4 Answers

Prevent Rigidbody From Rotating 3 Answers

Why Unity correctly builds a project but the editor freezes on the Build Progress window? 2 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