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
1
Question by mmangual_83 · Dec 17, 2013 at 02:16 PM · c#itweenmove an object

using itween to move objects in the 6 degrees of freedom

I am working on a school project where I have to give movement to an object. A friend of mine recommended that I use iTween. I started using it to move the object to the right but I want it to move the object right to left.

This is what I have so far:

 public void MoveAcrossXPlane()
 {
      iTween.MoveTo(_cubeObject, Vector3.right, 0.5f);      
 }


Can anyone help me understand what I need to do? Thank you in advance!

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
2
Best Answer

Answer by GameVortex · Dec 17, 2013 at 02:43 PM

Vector3.right is just a shorthand for new Vector3(1, 0, 0). So you can supply your own vector for the left direction instead which is the negative direction of right: new Vector3(-1, 0, 0) or you can reverse the direction of the right Vector: -Vector3.right

A note on iTween: All the move functions uses a point in space to move towards and not a direction. The Vector3.right will move the object to that point (1, 0, 0), you can make it move further by multiplying the Vector with the distance you want it to go (-Vector3.right * distance). It will eventually stop though.

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 mmangual_83 · Dec 17, 2013 at 02:50 PM 0
Share

That answers why my cube is behaving that way, thank you. I also want it to loop right to left and vice-versa. Any idea on how to do that?

avatar image GameVortex · Dec 17, 2013 at 03:08 PM 1
Share

That is slightly more difficult because you have to start using iTweens hash methods because the normal $$anonymous$$oveTo only takes a few simple paramteters. The Hash works like this:

iTween$$anonymous$$oveTo(_cubeObject, iTween.Hash("position", position, "speed", speed, "looptype", iTween.LoopType.pingPong));

To move back and forth between two points we specify the "looptype" as PingPong. The first point is the point the gameobject is already on and the second point is the position variable supplied in the hash. We also supply a speed variable, or you can change it to "time" to move based on time ins$$anonymous$$d.

See the other options for the hash in the documentation: **ITween**

avatar image mmangual_83 · Dec 17, 2013 at 03:17 PM 0
Share

Thanks, man! Rock on with your bad self!

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

18 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

Related Questions

How to control a game object's movement in iTween 1 Answer

how to loop an animation 2 Answers

How to reset an game object's position 1 Answer

RPC called by OnPhotonPlayerConnected doesn't work 2 Answers

Distribute terrain in zones 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