Author Topic: Move from position  (Read 2872 times)

Chris_E

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 1
  • Posts: 37
    • View Profile
Move from position
« on: April 22, 2012, 04:33:22 AM »
I love the ability to toggle a tween position.

I do not love the way it jumps to and from the "to" and "from" positions when you toggle it in the middle.

I made an inelegant solution to this, but would love to see a built in option that uses the current position as the "from" for the given move (not the same as the "from" field, obviously, since sometimes you're moving to the "from" field.)

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Move from position
« Reply #1 on: April 22, 2012, 03:07:41 PM »
Example 2 (object interaction) uses a tween, and you can toggle it mid-animation, and it doesn't jump. Check to see how you're using it.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Move from position
« Reply #2 on: April 22, 2012, 03:08:57 PM »
Even looking inside the Toggle() function:

  1. public void Toggle ()
  2. {
  3.         if (mFactor > 0f)
  4.         {
  5.                 mAmountPerDelta = -amountPerDelta;
  6.         }
  7.         else
  8.         {
  9.                 mAmountPerDelta = Mathf.Abs(amountPerDelta);
  10.         }
  11.         enabled = true;
  12. }

...you can see that it doesn't touch 'from' and 'to'.