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 johnnyBoy1986 · Mar 01, 2017 at 07:23 AM · positiontimeexportingangularvelocitytextfile

Exporting position, angular velocity, and time to a text file

Hi,

I'm trying to export some data from Unity to a simple text file. The main data I'm interested in is position and angular velocity. I've got a attached to a game object that also has a rigid body component.

So far I've been able to gather and export the position and angular velocity by calling InvokeRepeating() in the Start() method with functions like

 void RecAngVels()
     {
         angVels.Add(rb.angularVelocity); 
     }

So in Start() I'm calling InvokeRepeating("RecAngVels", 0.0f, 0.1f) to store the angular velocity at regular intervals, and a similar setup exists for position. I just have to hit a button that shows up in the game to stop InvokeRepeating() and export the stored data to their respective files.

I hope what I'm doing is clear so that my problem will be easier to understand. I was also trying to export time data to correspond to the positions and angular velocities. So I made a similar setup to get time data using Time.time, but when I export the data to the file I get a bunch of the following lines System.Collections.Generic.List`1[System.Single] instead of some time data.

Every time I call Time.time I just store it into a float list so I'm sure that I'm storing numbers and I'm not sure why they aren't being written to the file. Am I misunderstanding how Time.time works or is it something else that I'm missing?

Also, I was hoping to have the same amount of data for position and angular velocity but I get more position data than angular velocity data. Is this because I call InvokeRepeating() on my RecPositions() function before calling it on RecAngVels() in the Start() method? Would the solution be to make two separate Start() methods or two separate scripts?

I'm sorry for the really long post, but I'm very new to Unity and I'm just trying to figure this stuff out on my own, so I appreciate any help that anyone can offer. Thanks in advance!

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

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

3 People are following this question.

avatar image avatar image avatar image

Related Questions

What is wrong with this script ? if duration is 10 why the transform is moving in 11 seconds and not 10 ? 1 Answer

Camera rotation around player while following. 6 Answers

Change position (hover) over time with easing? 1 Answer

Why when changing some object position it's taking time like 3-5 seconds to change the object position ? 1 Answer

How to store previous locations in a list to teleport? 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