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 Dreeka · Mar 24, 2013 at 10:54 AM · transformlerpmove

Move an object down a little, then up to a position

Hey,

I have a game object, that I want to move down a little, and then up to a specific position in t time.

Lets say my object is at P0 position (0, 22, 0), and has a speed of S0(-15).

Now, I want to modify it's speed variable, to decrease (it will be calculated based on a distance of an object, lets say it is 2 at the moment), and after that, I want to increase it to move the object up to P1 position smoothly (it is constant, (0, 26, 0)), and do all of this in t time (it will be calculated as well, lets say it is 0.75 seconds at the moment).

It should move in a path like in the diagramm below (so, we should smoothly decrease the speed value, then increase it, and smoothly stop).

alt text

My question is, what is a good way to do this? The object is moving by this line (so the object only moves only up and down):

 thisTransform.position += Vector3.up * speed * Time.deltaTime;

diagram.png (2.4 kB)
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 Benproductions1 · Mar 25, 2013 at 04:38 AM 0
Share

A good way: Animation

A more dynamic way: 3d Bezier Curves

Don't try to do it procedurally

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by nsxdavid · Mar 25, 2013 at 05:06 AM

In addition to just using an Animation clip, you can also use an Animation Curve. This is one of the more powerful features of Unity that few people think to use.

Create a public member of type AnimationCurve. In the inspector you can edit that property with an interactive curve editor. In your code use the Evaluate() method on the curve member. Just pass in T.

In your case you might have a curve for the Y position and another for speed and just plug the evaluations into your maths.

Comment
Add comment · 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

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

12 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

Related Questions

How to move object from existing position to new position and change its animation? 1 Answer

move a gameobject to left/right while going up 1 Answer

Lerp a Object along X and Z axis only. 3 Answers

C# move y position of object not working 2 Answers

How Do I lerp a game object from positionA to positionB 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