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 Udorn · Feb 09, 2013 at 11:51 PM · 2ditweenorienttopath

iTween.MoveBy in 2D

Hi,

I want to use iTween.MoveBy in conjunction with orienttopath and I'm not able to succeed with it, even after reading the answers in itween Path, orientToPath and gameObject rotation, 2D game. Can somebody please help me?

My object is a ship, facing up in a ortographic camera. So y is facing up, x to the right and z to the back. As suggested in the linked answer I've put my ship into an empty GameObject with a x rotation of 270. So the blue z arrow is facing up and x is still facing to the right. The ship inside the empty GameObject has a x rotation of 90, so it's facing up again.

Through a trigger I'm executing now on the parent GameObject:

 Hashtable ht = new Hashtable();
 ht.Add ("orienttopath", true);
 ht["amount"] = new Vector3(1, 1, 0);
 ht["time"] = 2;
 iTween.MoveBy(shipParent, ht);

It should move to the upper right. The movement direction is ok, but the ship rotates around the x axis, so it's looking inside the screen. I tried many other settings, but all the time it's behaving wrong. Can please someone explain how to fix that problem?

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

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by robertbu · Feb 10, 2013 at 03:09 AM

Typically when something is "oriented" it means that the forward vector is oriented which is the Z vector. You start with the the Z vector pointed to the back, so I suspect you really wanted the X vector to be considered as forward. You can fix this by using an empty game object to move along the path and make your object a child of the empty game object. Your object is then has a local rotation so that it is facing the way you want.

Comment
Add comment · Show 1 · 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 Udorn · Feb 11, 2013 at 05:23 PM 0
Share

Thanks for your answer. Slowly, slowly I'm getting into it. At least

 ship.transform.Translate(ship.transform.forward * speed * Time.deltaTime, Space.World);

is functioning now correctly. The Space.World seems to be very important.

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

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

Using Itween with Unity 2D, sprite flips over while using orienttopath 1 Answer

iTween Path 2D rotation, orientToPath issue. 1 Answer

Path Controlled Character and Working With Physics on iTween 1 Answer

iTween 2D Path rotation 1 Answer


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