Search Unity

Movement / Time - Take complete control of both movement and time.

Discussion in 'Assets and Asset Store' started by Trinary, Jan 5, 2016.

  1. doq

    doq

    Joined:
    Aug 17, 2015
    Posts:
    121
    go home spell check, you're drunk. :)
     
    IsDon and Trinary like this.
  2. Trinary

    Trinary

    Joined:
    Jul 26, 2013
    Posts:
    395
    So a new version of Movement over Time should be coming out any day now. Maybe today.

    1.4
    - Updated the timing class to the latest version.
    - Reverted the pre-compiled dll to uncompiled source.
    - Added sequence multiplication operator.

    I'm hoping to carve away a bit more time and submit 1.4.1 next week. If there's anything else that anyone would like to see I would love to hear about it. Otherwise I can finish the system for instance grouping, work on the docs some more, and maybe make a good demo video.
     
    doq likes this.
  3. mrleon

    mrleon

    Joined:
    Sep 27, 2014
    Posts:
    18
    I got this because I liked more effective coroutines, seems useful but I can't figure out how to kill a sequence or stop it's effect and replace it with another, is this possible?

    One major issue is when the stripping level is on 'use micro mscorlib' (android) projects don't compile and throw a UnityException: Failed assemblies stripper even when just using it for the coroutines. If I remove movement / time files and revert Timing.cs to the more effective coroutines version the error goes away.

    Thanks for your work
     
    Trinary likes this.
  4. Trinary

    Trinary

    Joined:
    Jul 26, 2013
    Posts:
    395
    There's an action on the effect structure, I think it's called CancelIf (but I can't look it up right now since I'm on the road). If that action ever returns true it will abort the sequence. You can use the OnDone or the CancelIf action to start a new sequence of you want to.

    There are a range of ways to do anything, which allows you to be creative, but I'm working on a higher level api right now that should be a lot easier to get into.

    I'll have to look into your stripping level issue in more detail and get back to you about that. It's probably a function I'm using, and there's a good chance that I can change things around to remove that limitation.

    I think that MoT will work fine if you just drop in the latest version of MEC.

    I hope to put out the next version in 1 or 2 weeks.
     
    punk likes this.
  5. SilverStorm

    SilverStorm

    Joined:
    Aug 25, 2011
    Posts:
    712
    Just purchased this asset as I wasn't really feeling the coroutine system for more than just simple things.
    I know you can achieve this example when the main character enters a trigger zone to save the game but I just don't know how because there aren't any tutorials and for something like this documentation won't be suitable.

    -Make character unable to move
    -Zoom the camera in and open up the save screen
    -Fade in and out a "Please Wait" text
    -The text keeps fading like this until the save file is successfully found
    -Your save files fade in, you can now select a save file to save to
    - The game fades in a "Saved Game" text after successfully saving
    - The camera zooms back to normal view and waits a further 1 second
    - You can now move your character again.

    If you could help me out with this that would be great.
     
  6. Trinary

    Trinary

    Joined:
    Jul 26, 2013
    Posts:
    395
    Hello Silver,

    The way I see it you want to create a sequence that interacts with three different systems:
    1. Your character moving in your environment.
    2. A menu system.
    3. File/Networking access.
    A lot of the specifics depend on your existing architecture. I'm assuming your world and character moves via animations and/or physics. The easiest way to stop those is by setting Time.timeScale to 0. You can create a simple effect that transitions it from 1 to 0 and applies an easing to that effect if you like. You'll want every one of these transitions to have the Sequence.IgnoreUnityTimescale set to true. Set the OnComplete for the unity timescale event to start the sequence for the camera. You might also want to disable your character movement controller at the end of this sequence.

    The camera system is another system that depends on how you set up your environment. You can probably just define a simple effect that moves it from it's current position to a closer position. There are a lot of examples of doing that in the demos.

    Fading in and out text is pretty easy, see demo 2. Those buttons fade in and out based on triggers and change color. Your texts would be basically the same thing.

    File/Network access is a different sort of a thing. They are best handled via a callback. You can set the text fading in and out with a repeating sequence and set your CancelIf function to watch for some isDone boolean. You can also append a "drop out of sight" transition onto the end if you like (using OnDone).

    The rest of it is just creating the inverse sequences with slight variances, ending with setting the timescale back to 1.

    Does that help?
     
  7. SilverStorm

    SilverStorm

    Joined:
    Aug 25, 2011
    Posts:
    712
    Yes that helps thanks, I will keep you posted and I have a lot of questions but the fact that your plugin contains abilities like OnDone, CancelIf, IsDone open up a world of possibilities, not sure why it has 4 stars.

    When I test it thoroughly I will rate it myself.
     
    Trinary likes this.
  8. SilverStorm

    SilverStorm

    Joined:
    Aug 25, 2011
    Posts:
    712
    Hmm ok now that I gave an hour to inspect this seriously it seems I am left only with confusion. The documentation is very small and the demos don't provide any direction on what is going on.

    Where is the quickstart guide as I see the demos but have no idea where to begin or what is going on. I can't figure it out with the tiny manual I have been given.

    With what little I have figured out this is not something that fits into the "one line of code"....

    Not pleased with what I have to work with so far, the power of the plugin really isn't shining in it's current state.
     
    Last edited: Aug 22, 2016
  9. Trinary

    Trinary

    Joined:
    Jul 26, 2013
    Posts:
    395
  10. SilverStorm

    SilverStorm

    Joined:
    Aug 25, 2011
    Posts:
    712
    I didn't even know that existed, you didn't put a link in the asset store description, the docs or this threads introduction post. I will check it out thanks.
     
  11. Trinary

    Trinary

    Joined:
    Jul 26, 2013
    Posts:
    395
    Sorry that wasn't clear. The picture on the first page is a link. I plan to rearrange things soon. Perhaps I'll copy the information on the website into a pdf document.
     
  12. bzor

    bzor

    Joined:
    May 28, 2013
    Posts:
    35
    hi! I'm digging into this now and trying to figure out how to get a sequence to run in LateUpdate.. the docs say it's in Sequence.SequenceTiming, but it doesn't look like a Sequence has a SequenceTiming enum.. can you shed some light here?

    thanks!
    -kc
     
  13. bzor

    bzor

    Joined:
    May 28, 2013
    Posts:
    35
    sorry jumped the gun with that question.. it's sequence.Segment = Movement.Segment.LateUpdate;

    I'm for sure going to have some more questions, I'll make sure I have some better ones before asking again! Overall I'm digging the system, the setup is a little cumbersome and it's taking some getting used to, but it's so fast I don't mind.
     
  14. Trinary

    Trinary

    Joined:
    Jul 26, 2013
    Posts:
    395
    Sorry about that. Every once in a while I go through and update all the references in the documentation, but it sounds like the docs are due for another update.

    I've still been spending most of my time working on the core Timing class, but I think I only have one more major feature (a multi-threaded segment) and then then I'm going to come back to MoT and make it's core multi-threaded so it will be even faster (in theory anyway).

    I'm here if you have any questions.
     
  15. JonDadley

    JonDadley

    Joined:
    Sep 2, 2013
    Posts:
    139
    I tried updating my current project which uses MoT to Unity 5.5 but get this series of errors:



    Any ideas on what might be causing it / potential fixes?
     
  16. Trinary

    Trinary

    Joined:
    Jul 26, 2013
    Posts:
    395
    That one is pretty easy. The version of MEC Pro that is included with MoT is an older version.

    Overwriting the Timing script with the one from the latest version of MEC Pro would fix it. Or you can just add the lines to the top of Timing.cs yourself:

    Code (CSharp):
    1. #if UNITY_5_5_OR_NEWER
    2. using UnityEngine.Profiling;
    3. #endif
    4.  
     
    JonDadley likes this.
  17. bzor

    bzor

    Joined:
    May 28, 2013
    Posts:
    35
    hi I had to do that in all my profiler related scripts, so I tried that with yours as well but I still get this error:

    TypeLoadException: Could not load type 'UnityEngine.Profiler' from assembly 'MovementOverTime'.

    do I need a new assembly? thanks!
     
  18. Trinary

    Trinary

    Joined:
    Jul 26, 2013
    Posts:
    395
    Unity's auto upgrade process will upgrade the assembly automatically. I think it should be a simple matter of re-importing the dll and Unity should take care of it.
     
  19. bzor

    bzor

    Joined:
    May 28, 2013
    Posts:
    35
    yep reimporting the DLL fixed the errors, should have thought of that..
     
    Trinary likes this.
  20. Trinary

    Trinary

    Joined:
    Jul 26, 2013
    Posts:
    395
    Nice, I love a good story with a happy ending.
     
  21. bzor

    bzor

    Joined:
    May 28, 2013
    Posts:
    35
    hey man is your site down? trying to hit the docs blog.. thanks!
     
  22. Trinary

    Trinary

    Joined:
    Jul 26, 2013
    Posts:
    395
    Oh snap!

    It suddenly occurs to me that I was supposed to verify my address with the domain registrar. I'll get that taken care of ASAP.
     
  23. Trinary

    Trinary

    Joined:
    Jul 26, 2013
    Posts:
    395
    Website restored.
     
  24. tachyon-particle

    tachyon-particle

    Joined:
    Jan 5, 2016
    Posts:
    79
    Hi,

    I just purchased the Movement/Time, and the version of MEC Pro that is included is v1.11.2, as per comment in the Timing.cs file.

    Is this the same version as the MEC Pro in the Unity Asset Store?
    https://www.assetstore.unity3d.com/en/#!/content/68480

    Are the versions in sync?

    MoT and MEC Pro looks amazing so far.

    Thank you
     
  25. Trinary

    Trinary

    Joined:
    Jul 26, 2013
    Posts:
    395
    Sorry tachyon, it's a rather old version that is included, and it probably won't be updated for a long time, and might eventually be switched with the free version (maybe). However, all versions of MEC are compatible. If you have MEC Pro then you can overwrite the version of MEC that's included in MoT with the latest version and you'll be able to use all the latest features and improvements.
     
    tachyon-particle likes this.
  26. tachyon-particle

    tachyon-particle

    Joined:
    Jan 5, 2016
    Posts:
    79
    Hi,

    When I change to a new scene, the MoT seems to still be running to change a Light property that existed from the previous scene, and I get the following exception:

    upload_2017-2-25_19-15-38.png

    With the MEC, we can use tags to kill coroutines, especially when a GameObject it is trying to access is being destroyed.

    With MoT, are we able to kill a movement using tags, or something similar?

    Thank you
     
    Last edited: Feb 26, 2017
  27. Trinary

    Trinary

    Joined:
    Jul 26, 2013
    Posts:
    395
    @tachyon-particle I think that what you want is to make the sequence automatically stop when the object it's acting on goes out of scope. You do that by setting the ContinueIf field in the sequence. Something like: sequence.ContinueIf = light => light != null;

    However, you can also solve your immediate problem by calling Timing.KillCoroutines() whenever you change scenes. (or Timing.KillAllCoroutines() if you're on an older version)
     
    tachyon-particle likes this.
  28. tachyon-particle

    tachyon-particle

    Joined:
    Jan 5, 2016
    Posts:
    79
    Yes, both of your solutions work great! I will use both of them depending on per needed situations. For some reason, I had totally overlooked these options.

    With MoT, I am able to implement such amazing movements to produce so many advanced behaviors. This is an extremely powerful framework to truly take immersion and virtual reality to the next level. An awesome work of art.

    Thus, I am looking forward for many more great features of MoT in the forthcoming future!

    Thank you
     
    Trinary likes this.
  29. tachyon-particle

    tachyon-particle

    Joined:
    Jan 5, 2016
    Posts:
    79
    Need to confirm the following to make sure:

    In the documentation and also on your website, there is an example that shows the use of handles. Please see the below images. But, I noticed that the Timing.RunCoroutine() methods in that example are returning "IEnumerator<float>" handles. With the current MoT v1.5.1, that example works because it includes the older version of MEC Pro v1.11.2. I also have the other standalone product MEC Pro v2.02.1 which no longer returns "iEnumerator<float>" as handles, but instead, returns a "CoroutineHandle" object as the handle. So that original example doesn't run with the new MEC Pro unless the handles are updated to use of type "CoroutineHandle"

    The results of the 2 MEC version for this example returns different results. Please see below for the results images.

    Can you confirm?

    upload_2017-2-27_2-43-14.png

    results using 'IEnumerator<float>' handles
    upload_2017-2-27_2-45-6.png

    results using 'CoroutineHandle' handles
    upload_2017-2-27_2-52-41.png
     

    Attached Files:

  30. tachyon-particle

    tachyon-particle

    Joined:
    Jan 5, 2016
    Posts:
    79
    I have another question unrelated to the one immediately before this.

    As an example, for a simple call of:

    Sequence<Transform, Vector3> seq = MovementOverTimeExtensionFunctions.MoTWorldSpaceMoveTo( this.transform, 100.0f, new Vector3( 20, 0, 50 ));
    Movement.Run( seq );


    Is there a way to do something similar to when we use "Timing.WaitUntilDone(x)", in terms of waiting until the sequence completes?

    For the sequences, there is the "OnComplete", which can allow to invoke callbacks. But even with a callback, status of some object may still need to be polled to see whether something is done. Being able to wait unit the running of the sequence completes and then immediately proceeding to next logic would be very smooth. Is this possible in some way? Or maybe I overlooked some features, etc.?

    Thank you
     
  31. Trinary

    Trinary

    Joined:
    Jul 26, 2013
    Posts:
    395
    @tachyon-particle You can just change it over to CoroutineHandles. The handle object is a recent change and I still haven't updated the documentation. I definitely need to do that soon.

    I'll look into whether that order is correct, the result you posted there doesn't look like it's in the right order and if so I think I may have a good idea of why, but I need to confirm before I do anything. I'll get back to you on that.

    I see what you're saying about not using polling for everything. I originally had functionality to define waits but I ended up removing it because whenever I used it it created race conditions. I really want to make sequences into more of a graph some day, but that's a major redesign, and I have two assets that I need to release asap before I can get to that redesign.

    One thing you can do is set up the sequence in advance, store it, and then start it running in the OnComplete function of the previous sequence. That's why those extension functions don't automatically call Movement.Run, so you can call it at a later point or change it around a little before running it.

    I hope I've answered your questions. Active users like you really help me to set the priorities of what I'm going to work on. For the last few months MoT hasn't had any active users.
     
    tachyon-particle likes this.
  32. tachyon-particle

    tachyon-particle

    Joined:
    Jan 5, 2016
    Posts:
    79
    Yes, thank you for the recommendation. The sequence chaining does work, but the very last sequence of the chain may still need to do a callback to update a status somewhere for an external polling to detect, as to notify that the whole sequence chain has completed.

    I have created an example where I was able to implement waiting on a sequence until it finishes, and it worked. See the attached image. I created a simple class called "SequenceStatus" that needs an instance to be passed in as a reference to a method called checkStatus() for the OnComplete to do a set value. For this wait to work, the Movement.Run() needs to be wrapped inside a proper method as shown in the attachment image. There is one "Timing.WaitUntilDone(x)" internal to the wrapper and also one external to the wrapper.

    I have tested the new "CoroutineHandle" and it doesn't seem to work with "Timing.WaitUntilDone(x)" as also mentioned in the previous post, so thus, I had to revert back the older MEC Pro and use the "IEnumerator<float>" for my example to work properly. For some reason, when using "CoroutineHandle", the "Timing.WaitUntilDone(x)" just doesn't wait. I hope this can be confirmed, as you have mentioned in your previous post.

    Thank you for your response. I am looking forward to seeing more users of this product in the future, as this framework is so powerful, if one knows how to harness its full potential.

    upload_2017-2-27_18-54-37.png
     
    Last edited: Feb 28, 2017
  33. Trinary

    Trinary

    Joined:
    Jul 26, 2013
    Posts:
    395
    @tachyon-particle If you send me an email at the address at the top of the Timing script then I'll send you the new version and you can tell me if it works for you. I think it will.
     
    tachyon-particle likes this.
  34. tachyon-particle

    tachyon-particle

    Joined:
    Jan 5, 2016
    Posts:
    79
    I just sent you an email!

    Excited to test it out!

    Thank you
     
  35. tachyon-particle

    tachyon-particle

    Joined:
    Jan 5, 2016
    Posts:
    79
    I finally had time to start using MEC Threaded.

    All three modules working concurrently together is truly amazing and powerful.

    (MEC_Threaded + MEC_Pro + MoT) == AWESOME
     
    Trinary likes this.
  36. JesterGameCraft

    JesterGameCraft

    Joined:
    Feb 26, 2013
    Posts:
    452
    Hi,

    I'm considering purchasing this asset but had several questions. I'm currently using LeanTween. Have you done any profiling in terms of performance between competing Tween libraries/engines. I realize that your approach is different and you have custom coroutines and potentially threaded, so it's not exactly apples to apples, but that's OK. I would consider purchasing those assets too. It would be helpful to know how your solution compares against those other products though.

    My primary platform is iOS and I'm opportunistically targeting iPad 2 as the lowest end device, conditional on the game running smoothly.

    Also, if I want to create a cutscene where I have multiple "actors" moving in the scene and camera also moving, can MoT control all of the actors and camera individually? Lastly I've encountered an issue where even with Vector3.Lerp I can get a choppy camera movement, is MoT move accurate (smooth) then Lerp and in the same token other Tween solutions like LeanTween and DOTween.

    Thank You.

    Regards,
    Jester
     
    Last edited: Aug 27, 2017
  37. Trinary

    Trinary

    Joined:
    Jul 26, 2013
    Posts:
    395
    Hi Jester,

    I wish I had a better answer for you. I haven't had time to perform side by side tests. There was a time when I had hoped someone else might do that to be unbiased and such.. but performance testing is hard, especially when you are comparing apples to oranges like in this case. I would have to pay someone to do that or do it myself like DOTween and LeenTween did, and nither of those options are non-biased. I do want to get to performance comparisons eventually, but a lot of things have worked themselves higher on my to-do list.

    I believe that MoT is 20 - 50% faster than DOTween. I believe it's similarly faster than LeenTween. I'm quite sure that if I could find the time I could put together some very favorable graphs. I can't say that I've dug into either package in detail but I know that DOTween uses unity's default coroutines. I can tell you that I re-implemented more than just the coroutine system in making MoT. For instance, Unity's Slerp function is stateless and for MoT I re-implemented slerp in a stateful way that allows it to be nearly twice as fast. I am quite sure that no other tween package has done that. However, performance tests of tween packages don't normally test their actions in spherical space.. spherical movement is not a tween package's core use case but it's far more common when moving things in 3d space. That's one of the reasons why I really don't like to call MoT a tween system. It's really more like a library for movement in 3d that can perform all the same functions as a tween system if you choose to use it only in 2d space.

    MoT is very open ended. If Tween engines are like a train where you can put down invisible tracks for an object to follow, then MoT is more like a car. You define a set of rules and your object follows those rules. If you want to spend a little effort on it that path can be contingent on anything. I don't think MoT is artist friendly like tweens are, at least not in it's current form, but it's very programmer friendly especially if you want movement that reacts to its environment.

    Normally if you find choppy camera movement for a lerp the most common cause is accidentally performing the lerp operation from the fixed update timing segment. It's possible to make that same mistake in MoT. MoT will switch processing to the Update segment by default, but if you tell it to use FixedUpdate it will do that.

    Yes, MoT is made to control many different objects in your game or scene individually.
     
    theANMATOR2b likes this.
  38. JesterGameCraft

    JesterGameCraft

    Joined:
    Feb 26, 2013
    Posts:
    452
    Hi Trinary,

    Thank You for the thorough explanation I appreciate your time. I'll consider your framework once I complete current stage in my game. I'll be moving many objects in the cutscenes and this framework seems more efficient then LeanTween, even without the stats to back it up. I'll let you know what I find in terms of performance between LeanTween and MoT and rest of your infrastructure.

    Thank You about the FixedUpdate tip, I've known it but still appreciate it.

    Regards,
    Jester
     
    Trinary likes this.
  39. theANMATOR2b

    theANMATOR2b

    Joined:
    Jul 12, 2014
    Posts:
    7,790
    Just so ya know - I've been following your thread in hopes of this package becoming more 'artist' friendly (I might not be the only one). I currently use a combination of Playmaker and DOTween but would drop DOTween if MoT was more accessible to artists either by total editor/inspector functionality or Playmaker Actions. I like the little 'maybe' in the comment "in it's current form".
    Either way - very impressive product from what I have seen. Nice work Trinary.
     
  40. Trinary

    Trinary

    Joined:
    Jul 26, 2013
    Posts:
    395
    Thanks @theANMATOR2b . I do have plans for adding a higher level API with an editor gui that could take over a lot of the recycling tasks and improve memory efficiency.

    I think that would come with a renaming and rebranding of the asset. I won't say what the new name would be, but I do have one picked out. Right now I would just need a reason to dedicate the ~100 hours it would take to build that out. Sales thus far have been occasional at best.
     
    theANMATOR2b likes this.
  41. BlankMauser

    BlankMauser

    Joined:
    Dec 10, 2013
    Posts:
    138
    If I get MOT and the latest MEC how much GC allocation can I expect from usage? I assume 0 per frame, but allocations per call on a tween.

    If I pre-allocate for example can I basically avoid GC forever?
     
  42. Trinary

    Trinary

    Joined:
    Jul 26, 2013
    Posts:
    395
    You can get the allocations very low.

    Each effect is stored internally in a list. Those lists are pooled and recycled so you you could see a fair amount of allocations shortly after startup, but they will drop off once the pools fill up. In the demos that come with the package I'm seeing 200-300 bytes per new effect, but I think most of that is from the lambda expressions that I use for code simplicity. If you use private class functions instead of lambdas you should be able to get it down to about 60 bytes per new effect.
     
  43. MaddoScientisto

    MaddoScientisto

    Joined:
    Jan 30, 2015
    Posts:
    62
    Hey there, I've been trying using this for a while but I always get null reference errors whenever I change a scene and a sequence is running, apparently the sequence keeps trying to run even though the objects don't exist anymore and crash the game.
    Is there a way to completely stop the sequence if the object I need to run it on is destroyed?
    I know that MEC has CancelWith but I can't find an equivalent for MOT
     
  44. Trinary

    Trinary

    Joined:
    Jul 26, 2013
    Posts:
    395
    Hmm.. the function is Effect.ContinueIf(delegate { gameObject != null; });

    It's getting close to the time when I might make a major update to the framework. I have a lot of things I want to add and some performance upgrades as well. I'll look into making a more straightforward check for the gameObject being live with the new update.
     
    MaddoScientisto likes this.
  45. MaddoScientisto

    MaddoScientisto

    Joined:
    Jan 30, 2015
    Posts:
    62
    hmm I'm pretty confused because the effect does not have ContinueIf but the sequence does but I get the following error:
    Error CS1660 Cannot convert anonymous method to type 'Transform' because it is not a delegate type

    but in the end I could just do
    ContinueIf = x => x != null
    inside the sequence and I think it works, the documentation keeps mentioning effect for some reason though

     
  46. Trinary

    Trinary

    Joined:
    Jul 26, 2013
    Posts:
    395
    I would do x.gameObject != null if you're using the transform.

    Yeah, it looks like I need to clean up the documentation on that. I remember now that it was moved over to the sequence because it could be, and there are fewer sequences created than effects.
     
    MaddoScientisto likes this.
  47. contempt

    contempt

    Joined:
    Jul 31, 2012
    Posts:
    88
    I don't know if this asset is still being updated but I've had some issues when using Unity 2021.1.19f1 with MEC Pro and Movement over Time. I get closure warnings constantly for OnUpdate and CalculatePercentDone. If I fix the OnUpdate issue by setting OnUpdate after initializing the Effect i.e."_fadeSplash.OnUpdate = fadeCanvas;" I get a closure error for CalculatePercentDone with no solution to not trigger the closure warning. I can suppress the warnings but I'm concerned that I'm creating potential memory and performance issues. If I run the Demo4 Easing demo scene the console fills with closure warnings. Any advice would be greatly appreciated. I've used Movement over Time as my "tween" solution since 2016 and would love to keep using the asset in current and future projects.