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 Alanimator · Sep 05, 2012 at 09:54 PM · transform.positiontime.time

Transform position over X amount of time , how ?? c#

so i have my character move in a straight line but i want him to stop after 4 seconds . i have failed at trying to do this ( -)

transform.position += transform.forward 5.0f Time.deltaTime;

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 Screenhog · Sep 05, 2012 at 09:58 PM

Have you seen iTween yet? It's on the Asset Store, it's free, and it's simple to use. Your code would look like this (you just have to give it a position):

 iTween.MoveTo(gameObject, myPosition, 4.0);

Although, in your case, iTween.MoveBy might be more useful.

If you insist on changing the transform.position yourself, one way to do that would be to add a Vector3.Lerp.

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 Alanimator · Sep 06, 2012 at 12:26 AM 0
Share

wow iTween is very good screenhog

i added the script but it now displays an error saying

`UnityEngine.GameObject' does not contain a definition for `iTween' and no extension method `iTween' of type `UnityEngine.GameObject' could be found (are you missing a using directive or an assembly reference?)

avatar image Screenhog · Sep 06, 2012 at 05:53 AM 0
Share

You've added the iTween script to your project, right? What is the line of code you've written to move your object with iTween?

avatar image Alanimator · Sep 07, 2012 at 02:31 AM 0
Share

well it seems that the problem was not iTween itself but the silly structure of the C# script that i have to run it in . i am unable to run iTween functions in that area of coding =[

avatar image
0

Answer by moinchdog · Sep 18, 2012 at 12:50 AM

google transform.Translate or Vector3.Lerp

it will help

Dj

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

9 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

GameObject moving left to right AND up 1 Answer

noobNeedsHelp with writing script for movement 0 Answers

Instantiate object at specific distance from transform position? 1 Answer

How do I move my object smoothly using mouse,How do I make the object movement smooth ? 2 Answers

Transform Position X/Y increasing by no reason 2 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