Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 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 erfan · Jul 04, 2013 at 04:30 PM · rotationtranslationsmoothlysending object

How to Rotate and Translate smoothly an Object between 2 point?

hi . i have this code for above problem. an object that want follow thw way points. #pragma strict

 var waypoint:Transform [];
 internal var  currentWay : int=0;
 var TransformSpeed:float;
 internal var startTime:float;
 var duration:float;
 var time:float;
 function Start () {
     startTime=Time.time;
 }
 
 function Update () {
     
     //transform.Translate(0,TransformSpeed*Time.smoothDeltaTime,0);
     if (this.transform.rotation.z-waypoint[currentWay].transform.rotation.z<0.5 &&
         Vector3.Distance(this.transform.position,waypoint[currentWay].transform.position)<0.5)
         {currentWay++;
         startTime=Time.time;}
     var target:Transform =waypoint[currentWay];    
     transform.rotation=Quaternion.Slerp(
     this.transform.rotation,target.rotation,(Time.time-startTime)/duration);
     transform.position=Vector3.Lerp(
     transform.position,target.position,
     (Time.time-startTime)/duration);
 
  
  }

but the problem is each time object reach to the Way point it stops and then moves again. and it is not smoothly. how can i fix it.

Comment
Add comment · Show 2
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 DaveA · Jul 04, 2013 at 04:31 PM 0
Share

Read the scripting reference, it's all in there, with examples

avatar image kalen_08 · Aug 06, 2017 at 09:52 PM 0
Share

1 - this looks like its JS right? 2 - you want an object to just move between two points back and forth smoothly without stopping?

0 Replies

· Add your reply
  • Sort: 

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

17 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

Related Questions

How to smoothly rotate the camera to the rotation of the player? 0 Answers

Smooth Rotation 0 Answers

Flip over an object (smooth transition) 3 Answers

Translating measurement in rotation speed and game object size to non-technical staff 0 Answers

Rotation& translation problem 0 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