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 dumbat · Jun 30, 2014 at 06:11 AM · physicssimulation

Can I run a duplicate physical world at high speed?

I am writing a game where the player throws an object at a group of other objects. The result is chaotic. I was wondering if it was possible to simulate what will happen, before the object is thrown?

Ideally I'd like to duplicate the physical 'world', set the Time.timeScale to a large number so that this duplicate world runs very quickly. Having run the duplicate world for a given time I can then see what the effects were, which are what the effects would be in the original world if it continued running in its current state.

The game is not performance critical.

Is this a ridiculous idea? Or feasible?

Comment
Add comment · Show 6
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 Huacanacha · Jun 30, 2014 at 06:45 AM 0
Share

You may be able to get a reasonable result by duplicating your rigidbodies on a much smaller scale (say 1/1000) somewhere hidden to the camera. The relative speed will be 1000x due to the smaller scale. Things to be aware of: it won't be a perfect 1:1 simulation, collisions may be an issue (you can force continuous collisions for all micro-dupes but it's not exactly the same), physics sleep and maxAngularVelocity values should be set on each dupe rigidbody to 1/1000 of the current physics settings, Time.fixedDeltaTime (physics update rate) should be set as low as possible.

Alternatively use 1:1 scale for the duplicate world but increase the speed of everything to say 1000x. This creates an additional issue in that non-linear physics calculations (such as drag) with respect to speed won't be correct.

avatar image dumbat · Jun 30, 2014 at 06:52 AM 0
Share

Interesting ideas, thanks! Is it possible to have 2 worlds running, with different timeScales? I would ideally like the original world to stay at a timeScale of 1

avatar image CHPedersen · Jun 30, 2014 at 07:02 AM 0
Share

The physics engine in Unity is not deter$$anonymous$$istic. Sift through the answers in this thread and notice, in particular, the comment about players sometimes shooting dead enemies locally, but empty air on other machines, because the Source engine does ragdoll physics locally. This is because the physics engine utilized by Source, like Unity's, isn't deter$$anonymous$$istic, so when the same event is run multiple times (in multiple different clients, in this example's case), then differences like that occur.

Your idea of running a separate copy of the world would suffer exactly the same differences. If you're careful, and the results you're trying to predict are defined roughly enough, then it'll probably work most of the time. But sooner or later, you will come across some situation where it didn't work out, and your copy-world didn't match the actual result.

avatar image Huacanacha · Jun 30, 2014 at 07:07 AM 1
Share

I don't believe it's possible as Unity has a single Physics and Time system which applies to everything in-game. $$anonymous$$any of the physics settings can be overridden on a per-object basis but the fixed update time will be the same. I expect it would be a huge job trying to work around this, if it's even possible.

$$anonymous$$y suggestion would leave the original world at a time scale of 1, but you would need to run the fixed update very fast so that the small scale duplicate world physics are more accurate.

Another idea:

  1. Save the state of your world

  2. Use an alternate camera to fade out the current view (or render the current view to texture and just display that few seconds)... basically just don;t show the real word for a bit

  3. Bump the Time.timeScale to 100x or whatever speedup you need, and set the target frame rate really low

  4. Wait for results, saving what info you need (object positions, saved render images from a non-visible camera etc)

  5. Restore the time scale and world objects to original values, restore the camera, then show the results

This has the advantage that you are using the actual world objects, scale, and physics that you are simulating.

avatar image Ngoc Ngo · Jun 30, 2014 at 08:12 AM 0
Share

If you simply want to know the outcome without the intention of altering it, this will fit:

  1. Perform the deed in real scale, where the main camera didn't see it.

  2. Record the whole chain reaction of involved rigidbodies.

  3. At the end, you know what happen.

  4. Playback the recorded data where the camera can see it, just like it has not happened before.

You will have to suffer some kind of lag though.

Show more comments

0 Replies

· Add your reply
  • Sort: 

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

Help with orbits 1 Answer

Simulating the graphics of a rolling 3D ball in a 2D game 2 Answers

What would be the best approach to implement a conveyor belt? 0 Answers

cloth simualtion problem 0 Answers

simulating real world camera in unity 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