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 mmangual_83 · Jan 08, 2014 at 04:40 PM · c#itween

Issues with transitions

I am working with a program that handles with the six degrees of freedom (left-right, up-down, front-back, yaw, pitch, roll). I am using iTween which is an AMAZING tool that is currently handling the object's movement. But, I AM having a bit of an issue. This diagram should help:

alt text

As you can see the object travels diagonally and I want it to where if its in the second state I want the position updated to the position I want it. But I don't know what I am doing wrong.

In my class I have it set up like so:

             case ObjectAnimations.animation1:
                     MoveAcrossXPlane();
                 break;
             case ObjectAnimations.animation2:
                     MoveAcrossYPlane();
                 break;
             case ObjectAnimations.animation3:
                     MoveAcrossZPlane();
                 break;
             case ObjectAnimations.animation4:
                     RotateObject_Pitch();
                 break;
             case ObjectAnimations.animation5:
                     RotateObject_Yaw();
                 break;
             case ObjectAnimations.animation6:
                     RotateObject_Roll();
                 break;



     public void MoveAcrossXPlane()
     {
         iTween.MoveTo(_cubeObject_demo, iTween.Hash("name", "Xplane", "position", new Vector3(1, 1, 0), "speed", speed, "easetype", iTween.EaseType.linear, "looptype", iTween.LoopType.pingPong, "oncomplete", "PauseTween", "oncompletetarget", gameObject));
     }
     public void MoveAcrossYPlane()
     {
         _cubeObject_demo.transform.position = new Vector3(0, 1, 0);
         iTween.MoveTo(_cubeObject_demo, iTween.Hash("name", "Yplane", "position", new Vector3(0, 1.7f, 0), "speed", speed, "easetype", iTween.EaseType.linear, "looptype", iTween.LoopType.pingPong, "oncomplete", "PauseTween", "oncompletetarget", gameObject));
     }
     //...rest of the methods go down here



The user presses a button and that is how I am controlling each state and in the class that has the GUI button I inserted the logic to stop each animation as well as placing the object where I want it:

 switch (taskCounter)
             {
                 case 0:
                     iTween.StopByName(obj_animateBlock._cubeObject_demo, "Xplane");
                     iTween.MoveTo(obj_animateBlock._cubeObject_demo, iTween.Hash("position", new Vector3(-1, 1, 0)));
                     break;
                 case 1:
                     iTween.StopByName(obj_animateBlock._cubeObject_demo, "Yplane");
                     iTween.MoveTo(obj_animateBlock._cubeObject_demo, iTween.Hash("position", new Vector3(0, 1, 0)));
                     break;
                 case 2:
                     iTween.StopByName(obj_animateBlock._cubeObject_demo, "Zplane");
                     iTween.MoveTo(obj_animateBlock._cubeObject_demo, iTween.Hash("position", new Vector3(0, 1, 0)));
                     break;
                 case 3:
                     iTween.StopByName(obj_animateBlock._cubeObject_demo, "Pitch");
                     iTween.MoveTo(obj_animateBlock._cubeObject_demo, iTween.Hash("position", new Vector3(0, 1.2f, 0)));
                     iTween.RotateTo(obj_animateBlock._cubeObject_demo, iTween.Hash("rotation", new Vector3(0, 0, 0)));
                     break;
                 case 4:
                     iTween.StopByName(obj_animateBlock._cubeObject_demo, "Yaw");
                     iTween.MoveTo(obj_animateBlock._cubeObject_demo, iTween.Hash("position", new Vector3(0, 1.2f, 0)));
                     iTween.RotateTo(obj_animateBlock._cubeObject_demo, iTween.Hash("rotation", new Vector3(0, 0, 0)));
                     break;
                 case 5:
                     iTween.StopByName(obj_animateBlock._cubeObject_demo, "Roll");
                     iTween.MoveTo(obj_animateBlock._cubeObject_demo, iTween.Hash("position", new Vector3(0, 1.2f, 0)));
                     iTween.RotateTo(obj_animateBlock._cubeObject_demo, iTween.Hash("rotation", new Vector3(0, 0, 0)));
                     break;
             }

If anyone has any idea on how to fix this, I will be greatly appreciative. Thank you and God Bless.

transitionissues.png (30.5 kB)
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 gamenovice · Jan 08, 2014 at 04:45 PM

I'm not an expert in iTween, but you may want to check your MoveAcrossXPlane Method.

 public void MoveAcrossXPlane()
 {
 iTween.MoveTo(_cubeObject_demo, iTween.Hash("name", "Xplane", "position", new Vector3(1, 1, 0), "speed", speed, "easetype", iTween.EaseType.linear, "looptype", iTween.LoopType.pingPong, "oncomplete", "PauseTween", "oncompletetarget", gameObject));
 }

the part where you are declaring the Vector3 for the position has a 1 in both the x and y parameter spaces, that might be causing the diagonal issue you are seeing.

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 mmangual_83 · Jan 08, 2014 at 05:05 PM 0
Share

@gamenovice The reason for the 1 being in both x and Y is because the object is found in an elevated space (on top of a block) I know in the diagram I place a 0 where the Y is just for display. It was my bad and I am sorry for the mix up.

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

19 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 avatar image avatar image

Related Questions

Multiple Cars not working 1 Answer

Rotating an object using itween 1 Answer

using itween to move objects in the 6 degrees of freedom 1 Answer

Waiting between pingpong loops 2 Answers

Using iTween for custom variables 3 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