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 dorpeleg · Feb 01, 2013 at 01:31 PM · gameobjectdistanceitweenpathitweenpath

iTween MoveTo "Convoy"

Hello everyone.

I finally got my objects to move correctly along an iTween path, but now I have a new problem.

I have 7 gameobjects all running on the same path.

Each gameobject is being told to use the path in its own line with a delay, like this:

         iTween.MoveTo(car_1, iTween.Hash("path", iTweenPath.GetPath("ConvoyPath"), "orienttopath", true, "looktime", 0.001f, "lookahead", 0.001f, "speed", ConvoySpeed));
         iTween.MoveTo(car_2, iTween.Hash("path", iTweenPath.GetPath("ConvoyPath"), "orienttopath", true, "looktime", 0.001f, "lookahead", 0.001f, "speed", ConvoySpeed, "delay", ConvoyDelay));
         iTween.MoveTo(car_3, iTween.Hash("path", iTweenPath.GetPath("ConvoyPath"), "orienttopath", true, "looktime", 0.001f, "lookahead", 0.001f, "speed", ConvoySpeed, "delay", ConvoyDelay*2));
         iTween.MoveTo(car_4, iTween.Hash("path", iTweenPath.GetPath("ConvoyPath"), "orienttopath", true, "looktime", 0.001f, "lookahead", 0.001f, "speed", ConvoySpeed, "delay", ConvoyDelay*3));
         iTween.MoveTo(car_5, iTween.Hash("path", iTweenPath.GetPath("ConvoyPath"), "orienttopath", true, "looktime", 0.001f, "lookahead", 0.001f, "speed", ConvoySpeed, "delay", ConvoyDelay*4));
         iTween.MoveTo(car_6, iTween.Hash("path", iTweenPath.GetPath("ConvoyPath"), "orienttopath", true, "looktime", 0.001f, "lookahead", 0.001f, "speed", ConvoySpeed, "delay", ConvoyDelay*5));
         iTween.MoveTo(car_7, iTween.Hash("path", iTweenPath.GetPath("ConvoyPath"), "orienttopath", true, "looktime", 0.001f, "lookahead", 0.001f, "speed", ConvoySpeed, "delay", ConvoyDelay*6));


The values of speed and delay are so:

 private float ConvoySpeed = 2;
 private float ConvoyDelay = 2.5f;

I made the gameobject each with its own delay so it will look like they are driving one after the other.

My problem is, the gameobjects slow down at some points of the path (not sure why) and because of that they bump into each other.

Is there a way I can either prevent them form slowing down or make sure they keep the distance between each other?

Thanks!

Comment
Add comment · Show 5
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 ATMEthan · Feb 20, 2013 at 04:10 PM 0
Share

Can you try making car2-7 children of each other(car1 is the parent of car2; car2 is the parent of car3; etc) position them accordingly so they are in a single file line and then just itween car 1? Shouldn't that make them all move together? I did not test this so I don't know if this works just going off my itween knowledge/experience.

avatar image dorpeleg · Feb 20, 2013 at 04:28 PM 0
Share

Didn't try it, but my logic says that they will not rotate well because they are together.

When iTween will rotate car1, all other cars will rotate the same.

will result in a "line" of cars...

avatar image ATMEthan · Feb 20, 2013 at 04:40 PM 0
Share

Is this a 2d or 3d game?

avatar image dorpeleg · Feb 20, 2013 at 09:14 PM 0
Share

it's a 3D game

avatar image robertbu · Feb 20, 2013 at 11:02 PM 0
Share

An almost identical question to this one was asked a few weeks ago, and I don't believed it received any satisfactory answers. You might try using iTween.PointOnPath(). Establish a starting percentage for each of the cars that has them displayed as you want and then manage increment the percentage in code (rather than let iTween manage the movement).

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

10 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

Related Questions

Scale an iTweenPath 0 Answers

itweenpath scale and position 0 Answers

How to animate a moving platform GameObject? 2 Answers

changing itween moveTo speed param. 0 Answers

3D Text to follow a path; iTween 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