• 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 coolbird22 · Aug 31, 2014 at 07:56 PM · recordingreloadingrewind

How to record/save and replay/load a players' movement ?

How is such a behavior possible in Unity ? How can I use an array to save the position of the player and reload the same array to play when required ? Or is using a list a better thing than arrays ?

Consider this scenario. There are 3 objects - A, B and C. It is possible to control only 1 object at a time. Object A goes over some terrain and reaches a checkpoint, while B is waiting at the start. As A reaches the checkpoint, the movement is recorded and the game is restarted, with A now back at the start with B. Now, Object B has to go beyond the checkpoint, but this can happen, when the previously controlled Object A goes again to the checkpoint to unlock it, so that B can pass. Is it possible to save the movement of Object A in such a way, that it can be run again later ? This has to repeat for Object C again, so Object A and B now have to move as their movement was recorded, to help C cross the next checkpoint.

Thanks for reading the question and possibly providing a solution to it.

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

8 Replies

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

Answer by AlwaysSunny · Aug 31, 2014 at 09:59 PM

Interesting problem. Only the position of a given player A,B,C is important? There are no other actions which must be considered?

In that case, you could conceivably record the Vector3 position of each player in a list or array every N frames, then use some interpolation method to smooth between frames. Storing every single position of every frame is probably overkill, and doesn't sound wise.

The moment you include other factors besides position, this method falls apart. You'd then need to have every action the player takes fit into some object like PlayerAction, and store a list of those to play back instead.

Worth noting that you might ought to have an upper limit for your recorded movements and use a fixed length array. Resizing a very large list every N frames could create performance issues.

Also it occurs that your interpolation method for smoothing between recorded positions could probably be the same method you use to actually control the player, if you make your movement function "seek" a point rather than directly applying movement.

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 purpl3grape · Aug 23, 2019 at 03:41 AM

Hi, I'm really really really late to this. Hopefully y'all have robust playbacks by now. Perhaps, recording it every X frames, and then playing it back given that interval, and lerp it's position from one to the next.

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 omarcesar · Feb 02, 2016 at 05:30 PM

this plug-in helps record movement of any 3d object, including avatars or complex object with multiple children.. all you do is check one flag. Easy to import and use. check out the demo: https://www.youtube.com/watch?v=Ay-wuj5PvHU

link in asset store; https://www.assetstore.unity3d.com/en/#!/content/17836

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 omarcesar · Feb 02, 2016 at 05:30 PM

this plug-in helps record movement of any 3d object, including avatars or complex object with multiple children.. all you do is check one flag. Easy to import and use. check out the demo: https://www.youtube.com/watch?v=Ay-wuj5PvHU

link in asset store; https://www.assetstore.unity3d.com/en/#!/content/17836

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 $$anonymous$$ · Nov 02, 2015 at 07:24 AM

Thank you @iOSBoy!!

Wow- htat is awesome.

So, I was actually going to search a way to have frame-by-frame player position data and motions more exactly be dumped immediately into some kind of data-object externally in a file or an asset or maybe an RSS feed. Or to customise a pre-fab of another character! That might not be possible but htat's kind of what and how I would love to try.

So to begin, does anyone know how to take those position data and motions , and hten immediaely convert into a replay animation in another character? I mean, like automatically or stored somehow??

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
  • 1
  • 2
  • ›

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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

30 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

Related Questions

Need help with animation rewind 1 Answer

Enemy AI Reloading Problem, they reload with queue 0 Answers

How do I get Single ammo reloading to work? 0 Answers

Reload Ammo is not working 1 Answer

Guys i need help with audio! 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