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
2
Question by Jonny Lerner · Feb 18, 2011 at 08:50 PM · cameraphysicsitweenfloatingpointtweening

iTween's inaccuracy of final position

So I've been using iTween for a while and it's been quite awesome, however I just noticed a very concerning issue. I have an object, my camera in this instance, that was designated to move from (0,0,0) to (38, 48, 0). This is the call:

        iTween.MoveAdd(cam.gameObject, iTween.Hash(
            "amount", FinalCamOffset,
            "time", 1.0f,
            "easeType", iTween.EaseType.easeOutExpo
        ));

Where FinalCamOffset was defined as (38, 48, 0) and shown in the output window for confirmation. Looking at where it ended up these were the camera's coords after the tween was done: (37.96289, 47.95313, 0)

You could say that the error is very slight and practically invisible in this case, but these slight errors can accumulate and throw it off its proper alignment.

Is this a real bug or am I missing something on my end?

Thanks.

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

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by Jason B · Feb 18, 2011 at 09:06 PM

I've never used iTween before and don't really know what it does that a simple Lerp won't, but there's something there called EaseType? It looks like it's smoothing the motion as it comes to a stop. The smoothing is so aggressive that it will eventually come to a complete halt as it gets closer and closer to its target. I suspect this would be fixed if you changed the EaseType to something else, but again, I've never used iTween.

If this doesn't solve the issue, you could always check to see if the object is within a certain distance of its destination; for instance, if the object you're moving is 0.1 unit or less away from its destination, you could command it to snap to the destination position.

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 Jonny Lerner · Feb 20, 2011 at 07:06 AM 0
Share

You are correct, iTween does allow the use of different "ease types", and as my code sample above shows I was using "easeOutExpo". That being said, I could try out different ease types, but I'm using this one for aesthetic reasons. I hoped that at the very least iTween would've had a final line executing in the end of each tween that makes sure that the GameObject ends exactly in the designated spot.

avatar image
0

Answer by equalsequals · Mar 09, 2011 at 09:25 PM

A bit of a hack, but you could always force that to happen by adding an "oncomplete" argument to the hash args, which then manually sets the position to those coordinates if you're looking for pixel-perfect precision.

Hope that helps

==

Comment
Add comment · 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

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

No one has followed this question yet.

Related Questions

VR Camera jumps up and does not ignore collider even after turning off interaction between them in Layer Collision Matrix 1 Answer

EdyVehiclePhysics 0 Answers

2D 360 degress platformer example needed 0 Answers

How to punch a ball without loosing its momentum? 3 Answers

itween cameraFadeTo not working 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