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 dorpeleg · Jun 26, 2013 at 04:05 PM · itweenvalueinterpolation

iTween ValueTo interpolation ending with wrong value

Hello everyone.

I'm using ValueTo with a float.

My "from" value is 0 and my "to" value is 4.3 .

I used the function I'm calling from ValueTo to check what are the actual values that iTween is giving out.

The last 3 values where:

  • 4.3

  • 34.2

  • 65.3

So I end up with 65.3 as the value....

Any clues as to why this is happaning?

Anyone else encouterd this bug?

I reported this issue at iTween Project

Thanks!

Comment
Add comment · Show 3
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 DannyB · Jun 27, 2013 at 07:08 PM 0
Share

This is very odd. Can you provide a short self contained code that demonstrates the problem?

avatar image dorpeleg · Jun 28, 2013 at 01:13 PM 0
Share

I'll do that on Sunday when i get back to the office.

Thanks.

avatar image dorpeleg · Jun 30, 2013 at 07:17 AM 0
Share

I seem to have deleted that script.

But this is what I did:

I had a loop the goes over a list of gameobjects.

I check for a condition to see if I need to use iTween.ValueTo on the gameobject (only one in my case).

If the condition is true, the gameobject is given an iTween.ValueTo.

The iTween.ValueTo is given: from 0, to 4.9, time (can't recall), and all funcation calling related stuff (onupdate).

In the function that is being called, I just set a debug.log to show the value.

Thanks!

1 Reply

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by DannyB · Jun 30, 2013 at 07:49 AM

Well, without your exact iTween parameters it would be harder to offer help. But, I can tell you this: From my iTween experience, I can say ValueTo is working as expected.

There are three reasons that may give you some weird values:

  1. The time of the tween is too short.

  2. And/or it takes iTween a bit longer than expected to start the tween (i.e. the infamous AddComponent hiccup).

  3. And/or you are using some more complex ease type (e.g. elastic, bounce, easeOutBack).

As you know, iTween adds a component to your object that is responsible for the tween. The first time it does that, you sometimes experience hiccups. If the tween is too short, then by the time it starts, it should already be at a higher value (nearing its end) so the update loop may be called only a few times - a couple of times with the values that are near the "from" value, and a couple of times with values near the "to".

What you can do to remedy the situation?

  • Check if increasing the time of the tween helps

  • Check if adding a slight delay to the tween helps

  • Call iTween.Init( gameObject ) on your Awake() or Start()

  • If you have many objects that start executing iTween at the same time, you must Init them beforehand and even then, you may need to consider a different approach.

Finally, in your testing, eliminate any other variable, test first with a simple script, like this:

 void Start() {
     iTween.Init( gameObject );
     iTween.ValueTo( gameObject, iTween.Hash(
         "delay"    , 1,
         "from"     , 0,
         "to"       , 4.9f,
         "time"     , 0.2f,
         "onUpdate" , "UpdateValue",
         "easeType" , iTween.EaseType.easeInOutBack
     ));
 }

 void UpdateValue( float val ) {
     Debug.Log(val);
 }
Comment
Add comment · Show 2 · 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 dorpeleg · Jun 30, 2013 at 09:26 AM 0
Share

I think the problem is the time.

I'm providing very short times.

I can't really change the times.

But I guess that solves my question.

Do you think it will have the same issue if I just use $$anonymous$$athf.Lerp?

avatar image DannyB · Jun 30, 2013 at 09:34 AM 0
Share

Short times may still work with iTween. But, only if you can iTween.Init() it at least a quarter of a second or so before you need to call iTween.

With any of Unity's internal functions you are unlikely to have the same issues. iTween's biggest Achilles heal (but also its strength) is the fact that it adds a component at runtime. I believe this is the root cause for your hiccup, that in your case, manifests itself by missing critical frames.

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

16 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

Related Questions

Kinematic rigidbody with interpolation issue 0 Answers

How do I interpolate a value up and then back down? Gradual interpolation 2 Answers

can someone explain how using Time.deltaTime as 't' in a lerp actually works? 5 Answers

Unity Networking. Player flickers. 0 Answers

[PUN] Movement Interpolation 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