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 Polinator · Feb 22, 2013 at 05:55 PM · physicsoptimizationphysx

Is it possible to start a new game after a certain point in time of a previous playthrough?

Hello,

I'm wondering if I could start my game from a point in time after the physics engine has moved my game objects a bit.

I have many blocks that roll down a hill, and I want the game to start when the blocks are at the bottom of the hill, so the player doesn't have to watch them actually roll. I think I have to write down the position/rotations of all the blocks, and then manually move them there after stopping the play test. This can get quite tedious with many blocks. Is there a better way to do this?

It's basically saving the scene as it is after the physics engine has done its part moving the objects.

Comment
Add comment · Show 13
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 ByteSheep · Feb 22, 2013 at 06:12 PM 0
Share

Since you are using the physics engine and it is calculating the physics in real time you have to let the engine calculate the new position each frame. You could however check out Time.timeScale - it is normally used for slowmotion effects, but you might be able to set it to higher than 1 and "speed up time" (don't know if this will work though, haven't tried it).
Or you may have to check the position of each cube at a certain point in time and then save those positions in an array and instantiate the blocks when the game starts. Depending on how many blocks there are you may want to write script to help get the positions of all the blocks.
I can't think of any different ways..

avatar image Polinator · Feb 22, 2013 at 06:42 PM 0
Share

I'm trying to avoid the physics engine from calculating it all at runtime, because at the moment it's lagging the game. When the blocks stop moving the lag settles, so that's why I want it the game to just start there. There is no way to just "save" the scene as it is at that certain point in time?

avatar image Lockstep · Feb 22, 2013 at 06:45 PM 0
Share

Totally out of the blue, but maybe it works. Start your scene and pause it at the right time. Don't stop it, just pause. Then save the scene. No idea if this actually works.

avatar image Polinator · Feb 22, 2013 at 07:09 PM 0
Share

No, sadly that doesn't work. I've tried before asking, heh. That would make it too easy!

avatar image GC1983 · Feb 22, 2013 at 07:14 PM 0
Share

$$anonymous$$ake the variables static? shrugs

Show more comments

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by nsxdavid · Feb 25, 2013 at 04:20 PM

Using physics to place stuff is a feature sadly missing from Unity. I had such a feature in HeroEngine because it was so useful.

However there are tools in the Asset Store that let you maintain stuff that happens during play. For example, Editor++ comes to mind. Using that plugin you can then select all the cubes and have it remember their transform during play. Then stop and apply what was remembered and they'll be in their settled (at the bottom of the hill) location.

This is far easier than doing it manually with pencil and paper. But if you don't want to use a 3rd party component like that, you could write a script that on some input (say a button press) records all the important transform info from the objects you are interested in to a file. If you give them a unique name, then it would also be straightforward to read that file back in with yet another script (editmode this time) and apply the updated transforms back to said objects.

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 Polinator · Feb 25, 2013 at 04:32 PM 0
Share

Editor++ looks like exactly what I would need, but is there a 3rd party software that does almost the same thing but free?

If not it looks like writing all transforms into a file and then reading it out again would be my best bet.

Someone stated before that copying all objects during play mode and then pasting it would be a good idea. Can you explain why this doesn't work? Unity always crashes for me when I try pasting the gameobjects in. $$anonymous$$ight be too many things being pasted at once perhaps.

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

15 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

Related Questions

Help! how to convert input.GetAxis to Accelerometer 0 Answers

Why rotating the Terrain Collider does not work? 0 Answers

2D 360 degress platformer example needed 0 Answers

Cutting mesh colliders; Does Unity do culling automatically or do I make my own code? 2 Answers

Configurable Joint AccelerationDrive Flag 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