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 /
  • Help Room /
avatar image
0
Question by johnnyBoy1986 · Mar 04, 2017 at 10:09 AM · exportangularvelocityrecordpostion

Using InvokeRepeating()

Hi,

I'm new to Unity so I'm sorry if this question is too basic or been asked before. I'm trying to export position and rotational acceleration of a player controlled sphere. To do this I've made two simple functions, both in one script, where one adds position to a List and the other rotational acceleration to another List.

  void RecPoint()
     {
         positions.Add(transform.position); // store current position...
     }
 
     void RecAngVel()
     {
         angVels.Add(rb.angularVelocity); // store current angular velocity...
     }

To come up with a bunch of values I call InvokeRepeating() in the Start function twice. The first time I give InvokeRepeating() my RecPosition() function as input and in the second call I give it RecAngVel() as input. I've then got a GUI button set up that, when pressed, cancels the two calls to InvokeRepeating() and exports the data to a text file.

 void Start () {
         positions = new List<Vector3>();     
         angVels = new List<Vector3>();
         rb = GetComponent<Rigidbody>();
        
         // tSample = time after which to first call specified function
        // interval = how frequently the function should be called after initial call
         InvokeRepeating("RecPoint", tSample, interval);
         InvokeRepeating("RecAngVels", tSample, interval);
    }  

My issue is that I don't get an equal amount of data points for position and angular velocity but rather I get more position data than angular velocity data and I'm not sure why. Based on the code above I would assume that an equal amount of data would be stored into each list, but that's not the case. Is it because I call InvokeRepeating() with RecPosition() before RecAngVel()? Or is it something else that I'm missing?

I've been trying to figure this out for a few days now and I'm not making any progress, so I honestly appreciate any help or advice that people can share. Thanks in advance!

Comment
Add comment · Show 3
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 hexagonius · Mar 04, 2017 at 11:25 AM 0
Share

by how much do they differ?

avatar image johnnyBoy1986 hexagonius · Mar 04, 2017 at 07:05 PM 0
Share

88 for position and 22 for angular velocity, so they differ by 66. In the above code, I set tSample = 0.f and interval = 0.1f if that makes a difference.

avatar image hexagonius johnnyBoy1986 · Mar 05, 2017 at 06:08 PM 0
Share

ok, the way they're called is exactly the same. I don't think this code is the problem. but I said that in your other post :)

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

93 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

Related Questions

Unity export to Xcode 7.3 2 Answers

Problem when exporting the game to android / problema al exportar el juego a android 0 Answers

[HELP] Is it possible to export a 2D tilemap as an image? 0 Answers

Problem with character meshes in Unity (exported from blender) 2 Answers

Ball Physics? 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