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 SpectralEdge · Oct 14, 2012 at 02:42 AM · c#inputitween

iTween input with spring

I am trying to move a selected block the user grabs along one axis (x) when they push the a or w keys, while the key is pushed it should slide along and then when it is released, I would like it to spring in to place where they stopped pushing the key.

I am having difficulty with itween, it keeps moving the block in steps instead of smoothly.

 if(Input.GetKey(KeyCode.A) || Input.GetKey(KeyCode.D))
         {
             float horizontal = Input.GetAxis("Horizontal");
             
             iTween.MoveUpdate(gameObject, iTween.Hash("x", horizontal, "isLocal", true));
         }

I know, simplistic but I am really not sure how to get the effect I desire.

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 ZenithCode · Oct 14, 2012 at 09:53 AM

Add this to your hash: "easetype", iTween.EaseType.easeOutSine to solve your first problem.

Comment
Add comment · Show 5 · 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 SpectralEdge · Oct 15, 2012 at 04:03 PM 0
Share

I know the ease type, not worried about it right now. I need it to stop stopping.

avatar image ZenithCode · Oct 15, 2012 at 05:18 PM 0
Share

It is not moving smoothly because you are calling iTween in Get$$anonymous$$ey. This will restart iTween until player releases button. As a test, try and quickly tap the key once, and see if the behavior changes.

avatar image SpectralEdge · Oct 15, 2012 at 05:22 PM 0
Share

No the behavior stays the same.

avatar image ZenithCode · Oct 15, 2012 at 05:24 PM 0
Share

What you can try now is remove your code and try out the iTween Visual editor which is available on Unity AssetStore.

Check this quick tutorial if you need help to get started. http://www.youtube.com/watch?v=gBZeeDU962A

avatar image SpectralEdge · Oct 15, 2012 at 05:31 PM 0
Share

Also, it is not because of get key because if I just use getting the key to flip a bool and move constantly if the bool is true, it still inches its way across the screen. How do I just make it go one direction smoothly till you let go of the key?

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

10 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

Related Questions

Multiple Cars not working 1 Answer

Limit distance from start while using iTween 0 Answers

Distribute terrain in zones 3 Answers

How to prevent an animation from triggering more than on due to fast clicking? 2 Answers

iTween Path swap 2 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