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 /
avatar image
0
Question by rd42 · May 24, 2010 at 06:17 PM · speedplay

Make playback faster.

I've seen animation speed posts but they don't seem to apply ( or I can figure out how the apply to my issue). I have a simple transform that is moving a ball in a arc point by point. I would like it to go faster, it plays really slow. My input is an initial velocity and an angle, using that I calculate the x and y vectors and use the code below to move the object. It would be cool if my initial velocity could equate to m/s and look that way on the screen, right now the ball just creeps along.

Basically, how do I speed this up or make it so when x = 10 it goes 10 m/s?

transform.position = Vector3(x, y, 0);

//Full code

function FixedUpdate () { // Check if adjustment needs to be made for Time.time the game clock which is always running if (timeReset == true) { // Reset time to 0 newTime = Time.time; timeReset = false; yStart = transform.position.y; //Get initial y position of object for displacement calculations }

if (isPressed == true ) {

     // Convert theta and r vector to x y vector 
     xInitial = velMagnitude * Mathf.Cos(newTheta * Mathf.PI/180);
     yInitial = velMagnitude * Mathf.Sin(newTheta * Mathf.PI/180);

     // Displacement x,y
     x = xInitial * (Time.time - newTime);
     y = yStart + (yInitial * (Time.time - newTime)) + (.5 * gravity) * ((Time.time - newTime) * (Time.time - newTime));  // yi+vi*t-1/2*g*t^2

     // Move object
         //transform.position = Vector3(x, y, 0);
     transform.Translate((Time.time - newTime) * x, y, 0);
 } else { 
 isPressed = false;
 }

}

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

2 Replies

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

Answer by DanMarionette · May 24, 2010 at 06:56 PM

Hi, I'm new to Unity development myself, so somebody correct me if I'm wrong, but I think you first need to use transform.translate not position. Using position you are telling the object to just "be there" instead of "move there". The next thing is to use 10 * Time.deltaTime which should be exactly what your looking for, 10 m/s. Look up Time.deltaTime in the script reference and the example should be exactly what you after.

So to move 10 meters per second in x it should be something like,

transform.Translate(Time.deltaTime * 10, 0, 0);
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 rd42 · May 25, 2010 at 02:25 PM 0
Share

Translate makes the speed look right, but for some reason my initial vectors have no effect on the translate function now. I added the full code above if you want to look.

avatar image DanMarionette · May 30, 2010 at 10:55 PM 0
Share

I'm sorry to say I'm still on the basics of game program$$anonymous$$g myself. I'll have to leave this answer to someone better. Sorry I couldn't help you any more.

avatar image
0

Answer by rd42 · Jun 18, 2010 at 06:55 PM

This worked. I don't know if the is right or not, but I went to: Edit -> Project Settings -> Time and changed Time Scale to 3 and that worked. Time Scale is the speed at which time progress. Change this value to simulate bullet-time effects. A value of 1 means real-time. A value of .5 means half speed; a value of 2 is double speed.

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 Cyclops · Jun 18, 2010 at 07:12 PM 0
Share

Hm, I just posted a comment to your other question where the "solution" involved changing TimeScale. Basically I suggested it might be a dangerous idea. :)

avatar image rd42 · Jun 19, 2010 at 11:59 AM 0
Share

Caught in a double post :o At least they weren't both in the same forum :) I think i responded to your other post, was it the one about scaling the game objects appropriatly? It's starting to make sense now.

avatar image Cyclops · Jun 19, 2010 at 01:53 PM 0
Share

Actually, it was in UA, your Question about playbackspeed and FixedUpdate. Basically, I was saying that changing TimeScale to 3 might seem to work, but it might also be covering up a real, different problem. I'd be careful of using it for a quick fix.

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

No one has followed this question yet.

Related Questions

I am attempting to play an animation in reverse and slow it down, But it only seems to play forwards. 2 Answers

video texture plays too fast when adding audio 2 Answers

[Unsolved] Playing animation backwords [Unsolved] 1 Answer

Animation ["1"].speed = 0; Doesn't work 2 Answers

Animation Stop and Stay 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