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 Fred_Vicentin · May 10, 2013 at 05:59 PM · itweenpath

How does Paths Works on iTween

Hello guys, I'm starting with iTween and I want to do a Path Follow, to make that I need to create some empty Gameobjects and rename them ? Like (1,2,3,4,5) And say to iTween to do the path ?

I saw a script but I dont undertood the Hash

  iTween.MoveTo(gameObject, iTween.Hash("path", new Vector3[]{new Vector3(1,2,3), new Vector3(2,1,3), new Vector3(3,2,1)}, "time",5));

And

 iTween.MoveTo(gameObject, iTween.Hash("path",iTweenPath.GetPath("Path1"), "time",5));

I need some "light" to start to do.

Thanks Guys

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 Hybrid1969 · Sep 17, 2013 at 07:13 PM 0
Share

i tried to use this by creating a path in a string which is made from arrays and loops to create the path.

code is iTween.$$anonymous$$oveTo(gameObject, iTween.Hash("path", tempPath, "time",5));

sample string would be tempPath = "new Vector3[]{new Vector3(-33.7, 0.8, -32.9), new Vector3(-33.7, 0.8, -27.2), new Vector3(-33.7, 0.8, -21.5), new Vector3(-33.7, 0.8, -15.4), new Vector3(-33.7, 0.8, -9.0), new Vector3(-33.7, 0.8, -3.6), new Vector3(-33.7, 0.8, 2.9), new Vector3(-33.7, 0.8, 9.3)}"

but I get the error

InvalidCastException: Cannot cast from source type to destination type. iTween.Generate$$anonymous$$oveToPathTargets () (at Assets/Plugins/iTween.cs:3523) iTween.GenerateTargets () (at Assets/Plugins/iTween.cs:3162) iTween.TweenStart () (at Assets/Plugins/iTween.cs:4603) iTween+c__Iterator2.$$anonymous$$oveNext () (at Assets/Plugins/iTween.cs:6567)

any suggestions?

1 Reply

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

Answer by ByteSheep · May 10, 2013 at 06:20 PM

The first code snippet is creating three Vector3s and storing them in a Vector3 array.
The second piece of code retrieves an iTweenPath named "Path1" and uses the points created for that path.
One of the useful features of iTween is the visual path editor that lets you easily create these paths - here's an example:
http://www.youtube.com/watch?v=qRafXt26a_E

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 Fred_Vicentin · May 10, 2013 at 06:50 PM 0
Share

The only way is using iTween Visual Path ? I foud only iTween Visual Editor on asset store, this is the only way ?

avatar image ByteSheep · May 10, 2013 at 06:56 PM 0
Share

No, as shown in the first code snippet you can create an array of 3d points directly in the code that form a path.
The array of Vector3 points is this part:

 new Vector3[]{new Vector3(1,2,3), new Vector3(2,1,3), new Vector3(3,2,1)}

The first bit declares the array and would be:

 new Vector3[]{}

Then you can start adding Vector3 points inside the array:

 new Vector3[]{new Vector3(0,0,0), new Vector3(0,0,5)}

If you don't know what a Vector3 is then you can check the docs here.

avatar image Fred_Vicentin · May 10, 2013 at 07:23 PM 0
Share

I solved from another way, without visual editor, thanks guys =)

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

16 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

Related Questions

Push an object along a path? 2 Answers

itween path restrict rotation on TWO axis 0 Answers

Camera switching with iTween Touch 1 Answer

iTween Path easing in and out 0 Answers

iTween Path Rotation 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