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 /
This post has been wikified, any user with enough reputation can edit it.
avatar image
0
Question by melkorinos · Feb 14, 2015 at 03:40 PM · timetranslatemovingtimescale

Moving objects when timescale is high, which .time to use ?

Hi all

I want to iteratevely run my game a lot of times, so i want to have my time scale at least at 20. The problem is that this affects my two moving objects in my tower defence game, the enemies and the bullets from the tower, causing me to get very different game results from when i was running with timescale = 1

I use to move them inside Update like this:

 transform.position += dir * speed * Time.deltaTime;

However, the high timeScale affects deltaTime and i get different results. I already tried some other times, like Time.smoothedDeltaTime or with 1/Time.timeScale , but it doesnt seem to work. Also i am randomly trying, since i don't really grasp the Time concepts within unity.

My goal is to have my level run a hundred times so i can gather some data (e.g enemies survived), so i dont really care how it looks, but more about just finishing the level faster.

Comment
Add comment · Show 1
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 incorrect · Feb 15, 2015 at 10:21 AM 0
Share

Please, give more detailed description what's wrong with bullets and towers and how it causes different results. We can figure out why it's happening.

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by giulio-pierucci · Feb 14, 2015 at 03:49 PM

For Time.timeScale != 0

 transform.position += dir * speed * Time.deltaTime * 1 / Time.timeScale;
 
Comment
Add comment · Show 9 · 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 melkorinos · Feb 14, 2015 at 04:41 PM 0
Share

This doesnt work for my case. With your way, everything moves smoothly in whatever timescale i set my game, but this is NOT my goal. I want to run my game a lot of times to simulate some values ( e.g enemies survived) so i dont care how it looks when it runs at high speeds. Hope i am understood.

I guess my title is a little misleading.

avatar image giulio-pierucci · Feb 14, 2015 at 09:43 PM 0
Share

Ok, sorry. I understand now, but, witch problems you have when run game setting timescale to 10 for example?

$$anonymous$$issing collisions?

avatar image melkorinos · Feb 15, 2015 at 12:33 AM 0
Share

I currently think/exa$$anonymous$$ing if it is due to them remaining for less time inside the towers' collider since i was moving them like i was (since deltaTime is affected by timescale). Other than that, the towers have a circle collider and the enemies a box collider and a non kinematic rigidbody. I detect the collisions with OnTriggerEnter

Problem

capture.jpg (31.6 kB)
avatar image giulio-pierucci · Feb 15, 2015 at 01:57 AM 0
Share

Ok, but the moviment is caused by Trasnform.Translate/Transform.Position or by Rigidbody.xxxxxx?

And on rigidbodies, how are the settings?

avatar image giulio-pierucci · Feb 15, 2015 at 01:03 PM 1
Share

"transform.position +=" may cause to skip other colliders at elevated speed.

In frame N, object is before, at frame N+1 object if after.

You'd move using rigidbodies

Show more comments
avatar image
0

Answer by meat5000 · Feb 15, 2015 at 10:27 AM

http://docs.unity3d.com/ScriptReference/Time-unscaledDeltaTime.html

Comment
Add comment · Show 2 · 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 melkorinos · Feb 15, 2015 at 08:21 PM 0
Share

Your method seems to have the same effect as giulio's comment. It makes them move smoothly at high speeds but that is not what i am trying to do. For instance everything else runs at high speeds, like shoot rates and respawn timers, which is what i aim for.

avatar image meat5000 ♦ · Feb 15, 2015 at 08:28 PM 0
Share

This is simply a time factor which is unaffected by TimeScale. It all comes down to how you use it.

Note that realTimeSinceStartup is also unaffected by TimeScale.

Changing TimeScale alone seems to affect FixedUpdate. Read the Time page in the Scripting API; observe the effects of changing fixedDeltaTime.

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

Timed actions 1 Answer

How Can I Make a Moving Object with a trigger reaction ? [C#] 1 Answer

Javascript Timescale Problem 0 Answers

Can i ignore timescale when playing AudioSource.PlayClipAtPoint ? 1 Answer

'timeScale' is not a member of 'Time' 1 Answer


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