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 silviu-georgian77 · Sep 27, 2016 at 05:12 PM · physicsvelocitymathfixedupdatekinematic

Convert from m/s to m/fixedFrame

Is it possible to convert from Meters/Seconds to Meters/FixedFrame?

The thing is that I compute Velocity from the formula:

d = vi t + ((1 / 2) a t ^ 2) => vi = (d - ((1 / 2) a * t ^ 2)) / t, where t is in seconds, a is in m/s^2 and d is in meters

From this formula I get the velocity in Meters/Seconds. After this, I scale the velocity like this:

velocity *= Time.fixedDeltaTime (1)

I want to decelerate the velocity inside FixedUpdate() and there i have something like:

velocity += deceleration * Time.fixedDeltaTime (2)

Something tells me that the first line (1) is not accurate. My object stops much earlier from movement. Is there a corect way to do this conversion?

PS: I have my reasons why I do not use Unity's physics for this part of the project.

Edit: After some calculus, I figured out that the above lines do actually scale my velocity and acceleration, but there is another problem.

Here is an example:

Before convertion: velocity = 1, acceleration = -0.2 It would take me 5 frames to get to velocity = 0.

After convertion (Time.fixedDeltaTime = 0.02): velocity = 0.02, acceleration = 0.004 It would also take me 5 frames to get to velocity 0.

How do I get my velocity to 0 in the time I provide to the formula (the one from the very top of this post)? At this moment, each second of that time acts like a single frame after covertion.

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

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by tanoshimi · Sep 27, 2016 at 05:43 PM

If I've understood you correctly, don't you mean velocity /= Time.fixedDeltaTime?

Comment
Add comment · Show 3 · 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 silviu-georgian77 · Sep 27, 2016 at 05:54 PM 0
Share

Not really. That value would mean how many times is my velocity bigger than fixedDeltaTime. What I want is the velocity scaled from m/s to m/fixedDeltaTime.

avatar image NoseKills silviu-georgian77 · Sep 27, 2016 at 06:09 PM 0
Share

Then you must mean the reverse velocity *= Time.fixedDeltaTime

If your object moves 2 m/s and physics update rate is twice a second, Time.fixedDeltaTime will be 0.5 and you'll get a result of "1".

That's more like "1m per FixedUpdate()" though

avatar image silviu-georgian77 NoseKills · Sep 27, 2016 at 06:23 PM 0
Share

You are right, velocity *= Time.fixedDeltaTime is correct. But now I realize what the real problem is. I have updated my post, please check

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

87 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

Related Questions

What is drag and velocity measured in? 3 Answers

Calculating force 1 Answer

How does the velocity of a ball flying throw a portal change when the portal is rotated? 2 Answers

Velocity from Rigidbody and from Transform don't match for small dt 1 Answer

Set velocity of kinematic rigidbody appropriately 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