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 akasurreal · Jan 08, 2012 at 02:05 AM · 2ditweenitweenpath

iTween 2D Path rotation

I am trying to use iTween to follow a looping path I created and have my sprite orient to the path on the z-axis so it rotates as it follows the path. I am using 2D Toolkit sprites.

The problem is that it doesn't seem to be working. And if I don't restrict the Z-axis, the sprite becomes invisible because of x/y rotation happening. Not sure what I am doing wrong.

Relevant Code Snippets:

     if (Input.GetKeyUp(KeyCode.L) && !bCharFollowingPath)
     {
         bCharFollowingPath = true;
         ht = new Hashtable();
         ht.Add("path", iTweenPath.GetPath("Loop1"));
         ht.Add("time", 4f);
         //ht.Add("looktime", 0.6f);
         ht.Add("lookahead", 0.1f);
         ht.Add("orienttopath", true);
         ht.Add("axis", "z");
         ht.Add("easetype", iTween.EaseType.linear);
         ht.Add("oncomplete", "Path_OnComplete");
         ht.Add("oncompletetarget", this.gameObject);

         iTween.MoveTo(sprChar.gameObject, ht);    
     }
 }

 void Path_OnComplete()
 {
     Debug.Log("Done");

     bCharFollowingPath = false;
     sprChar.transform.position = new Vector3(150, -316, -5);
     sprChar.transform.eulerAngles = new Vector3(0, 0, 0);
 }


z-restricted:

alt text

not z-restricted:

alt text

It does appear by looking at the wireframe on the not-z restricted, that it is following the path and rotating but not in a way that is useful =)

Any help greatly appreciated.

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 AngryOrange · Mar 29, 2013 at 02:26 PM 0
Share

Hi I have exactly the same problem.. did you resolve it ? Can you tell me how ?

avatar image jamespaxi · Jul 20, 2013 at 07:52 PM 0
Share

This is my problem too now :|

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by AngryOrange · Mar 29, 2013 at 03:26 PM

Just put, your sprite in empty game object and make it z orientated.

Comment
Add comment · Show 8 · 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 MBraiN · Apr 11, 2013 at 02:11 PM 0
Share

How can i make it "z orientated" ?

avatar image AngryOrange · Apr 11, 2013 at 02:15 PM 0
Share

Just use rotation value in transform in the Inspector...

avatar image MBraiN · Apr 11, 2013 at 02:44 PM 0
Share

Should i move parent game object? Or my sprite?

avatar image AngryOrange · Apr 11, 2013 at 02:47 PM 0
Share

Put your sprite in side empty game object. Rotate your sprite as you like but emptyGame object ( parent) make z orientated and move this using iTween. You have to move your empty game object right now not a sprite

avatar image MBraiN · Apr 11, 2013 at 02:57 PM 0
Share

I couldn't make it work. But thank you for help. :)

Show more comments

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

8 People are following this question.

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

Related Questions

tween Path animation & touch control 1 Answer

iTween not relative to parent 0 Answers

[SCREENSHOTS] itween Path, orientToPath and gameObject rotation, 2D game 3 Answers

Update iTween Path at Runtime 1 Answer

how to use float update for speed in itween,itween how to use float update 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