Search Unity

Chronos – Time Control – Unity Awards Winner

Discussion in 'Assets and Asset Store' started by LazloBonin, Apr 9, 2015.

  1. Seank23

    Seank23

    Joined:
    Aug 4, 2015
    Posts:
    4
    Hi again,

    Is there a way to have an occurrence that does not require a value to be returned between the forward and backwards delegates? I am asking this because I am trying to create an occurrence in which going forward would add 1 to a static variable and going back would subtract 1 from it, like this:

    Code (c#):
    1.  
    2.         if(crystalPickedUp[0] == "resetCrystal")
    3.                 {
    4.                     if(PlayerDataControl.data.resets < PlayerDataControl.data.resetSlots)
    5.                     {
    6.                         time.Do
    7.                         (
    8.                             false,
    9.                             delegate ()
    10.                             {
    11.                                 PlayerDataControl.data.resets++;
    12.                                 ui.DestroyResets();
    13.                                 ui.InstantiateResets();
    14.                             },
    15.                             delegate ()
    16.                             {
    17.                                 PlayerDataControl.data.resets--;
    18.                                 ui.DestroyResets();
    19.                                 ui.InstantiateResets();
    20.                             }
    21.                         );
    22.                     }
    23.                     Audio.gameAudio.PlaySFX("crystal");
    24.                 }
    25.  
    This throws the error: "The type arguments for method 'Timeline.Do<T>(bool, ForwardAction<T>, BackwardAction<T>)' cannot be inferred from the usage. Try specifying the type arguments explicitly"

    I assume that's because no value is being passed between the delegates but in this case I literally have not got a value to pass between them.

    Hope you can help.
    Thanks.
     
  2. Griffo

    Griffo

    Joined:
    Jul 5, 2011
    Posts:
    700
    @ludiq everything all right? Or have you gone on holiday? Not heard from you for 2 weeks and we could do with some support.
     
  3. DocMcShot

    DocMcShot

    Joined:
    Mar 18, 2014
    Posts:
    14
    @ludiq I have a really simple question, that I believe I know the answer to. I always try to be aware of the things that I import into my project. I noticed when importing, there's a fairly large section under the "Playmaker" check box. If I'm not using PlayMaker, is it safe to uncheck it? It won't affect any other functionality of the Chronos other than it's ability to be used with PlayMaker, correct? Thanks!
     
  4. waynehelley

    waynehelley

    Joined:
    Feb 13, 2016
    Posts:
    2
    Hi all, has anybody being getting this error when trying to export to Windows devices?...

    Assets\Chronos\Source\Dependencies\Reflection\Utilities\TypeSerializer.cs(31,29): error CS1501: No overload for method 'GetType' takes 3 arguments
     
  5. Stanchion

    Stanchion

    Joined:
    Sep 30, 2014
    Posts:
    269
    Is this custom recorder broken for anyone else? I can't add anything
    Edit: looks like you can manually add variables with the debug inspector
     
    Last edited: Mar 14, 2016
  6. PicturesInDark

    PicturesInDark

    Joined:
    Jun 13, 2013
    Posts:
    89
    Hi all!
    I have a problem. In one of my scenes, in editor I have Timekeeper and all works perfectly.
    But in compiled, in that particular scene i get error:
    UnityException: Missing 'Chronos.Timekeeper' singleton in the scene.

    In the other scenes works ok.
    Any clue?
    Regards
     
  7. tansir

    tansir

    Joined:
    Jan 5, 2016
    Posts:
    14

    @ludiq
    Hi ,I use your time controller plugin in my demo recently,it looks really awesome!!!.
    but I got a animator problem : when I clicked to move player(with navmesh),and then rewind,the animator rewind is fine at first time, but the second time has no action,it seems that lost record data maybe:(.You can watch my video uploaded.thanks a lot.
     
  8. Arganth

    Arganth

    Joined:
    Jul 31, 2015
    Posts:
    277
    is this asset abandoned?

    i hope not....
     
    Griffo likes this.
  9. Griffo

    Griffo

    Joined:
    Jul 5, 2011
    Posts:
    700
    Looks like it .. Very bad support ..
     
  10. Stanchion

    Stanchion

    Joined:
    Sep 30, 2014
    Posts:
    269
    I got an email back from support@ludiq.io today, so definitely not
     
  11. LazloBonin

    LazloBonin

    Joined:
    Mar 6, 2015
    Posts:
    813
    Wow, apologies everyone! For some reason the Unity forums stopped sending me email notifications, and I relied on those to know if there were new support requests. I'll look into it, but in the mean time I'll try to answer all your questions today. I'm also working on v.2.4 as I write.
     
    Arganth likes this.
  12. LazloBonin

    LazloBonin

    Joined:
    Mar 6, 2015
    Posts:
    813
    My instinct is that is has to do with animator recording. Rewinding animators in Unity has to be done via their own recording methods (trust me, I've tried to avoid it, but it's impossible), meaning that you can't rewind past what's been recorded. In the scenario you describe, you're trying to rewind below time zero, am I right? In this case, it's "normal" that there is no data to fetch for rewind, as none had been recorded before you started the scene.

    The odd behaviour is popping back at origin. I'll setup a test scene and try to figure out what's going on there.

    As I've mentioned numerous times before, Chronos is not a replay plugin. (I don't mean to be rude, your question is legitimate -- it's just that I had to write this so many times I'm considering the purchase of www.ChronosIsNotAReplayPlugin.com ;) ) It cannot scrub at any recorded time (what you call "jumping"). For this reason, it can't instantly go back to a specific frame and create the exact same stutter effect. The closest approximation of it would be to quickly switch the time scale between very high and very low values at small intervals, but I doubt it would give out the exact same effect.

    Unfortunately, it's not easy to hack it in. If it was, I'd have done it long ago! I've been stuck developing a proper replay plugin for months now, but I will keep you all updated if I ever manage to succeed.

    Ah, finally! That makes sense! Chronos currently only supports 1 of each type of built-in component per game object (Animation, Animator, MavMeshAgent, Rigidbody, Rigidbody2D, Transform, WindZone and, as you've discovered, AudioSource). That makes sense for every one of those, except for AudioSource, as you've now made me realize. I'll look into multi-audio support for a future version, but it might not make it for v.2.4; I have to be very careful not to break any existing implementation, and there's quite a bit of documentation updates involved, too.

    Hi Sean! You can simply return null in the first delegate, and have an unused object parameter in the second one. I consider it a bug and I'll look into making this unnecessary for v.2.4, because I believe the code you wrote should work.

    You can uncheck / delete the PlayMaker folder and the PlayMaker example if you wish. Chronos uses a smart plugin detection code and will work either way.

    Are you using version 2.3? This bug is supposed to be fixed. Note that CustomRecorder is not supported on Windows Phone, however.

    Could you tell me more about the scene where you get the error? Also, can you check in your Script Execution Order settings if Timekeeper is before other Chronos components?

    Hi Tansir! Unfortunately, that's a known issue. Unless Unity provides us with a way of caching, importing or exporting animator recording data, I cannot fix it. Thanks for the detailed bug report, but I'm sorry, I can't help you at the moment.

    Griffo, I do apologize for the lack of updates, but I find your comment a bit harsh. I've been providing support for your issues multiple times over the last months, even on matters not directly related to Chronos.
     
    Gus3D, ilmario, Griffo and 3 others like this.
  13. DocMcShot

    DocMcShot

    Joined:
    Mar 18, 2014
    Posts:
    14
    Ludiq,

    I'm having a problem getting Chronos to be able to access certain gameobjects. Here's my setup I have a Tree branch that has 4 children acorns. I have a branch controller script that is a component of the Branch (the parent gameobject) that holds 4 references (one for each acorn). The script uses a coroutine to unparent the acorns and then turn off there kinematic property, making them fall. All of this worked fine.

    Now I'm trying to set it up to work with Chronos and I can't get it to work. I know the deprecated the .rigidbody2d property access in 5.3.3. I don't know if that messes with Chronos since now you have to use gameobject.GetComponent<Rigidbody2d>() to access the the rigidbody2D component. I've attached my gameobject s
    structure and the code for the Branch Controller script. Any suggestions?

    Prefab structure:
    Branch Structure.PNG


    Code for branch controller:
    Branch Code.PNG
     
  14. Griffo

    Griffo

    Joined:
    Jul 5, 2011
    Posts:
    700
    @ludiq Glad to hear your back, and sorry if you thought I was being harsh, didn't mean to offend.

    But as we had heard nothing for a while I was getting worried that we might not hear from you again and as I still have the problem I posted in #435 January 28 making Chronos unusable for me, and thats a great shame as I think it's a great piece of software that I really want to have in my game.

    You replied in #442 saying it's most probably my re-spawn code so I posted it for you to take a look at in #445 on February 13th .. Well over a month ago so you can see why I was getting worried.

    As I said sorry for any offence taken, and I would really like to use Chronos but without finding the problem it's unusable for me.

    Thanks.
     
  15. LazloBonin

    LazloBonin

    Joined:
    Mar 6, 2015
    Posts:
    813
    Do your acorns have timelines, or only your branch? Currently, all objects that require Chronos functionality must have a timeline attached. This is actually changed in v.2.4, where a new TimelineChild component will be introduced to simplify this kind of setup.

    I understand. I'm sorry, but I can't remotely debug your object pooling system; these are usually complex structures and without having the whole code and spending several hours bug hunting, I cannot perceive where the problem occurs. Here are some ideas to explore: try calling CacheComponents after your respawn code in case data was lost; try logging the angularSpeed without a Timeline attached to see what it is before Chronos modifies it (although Chronos cannot possibly divide it by 0, so I don't understand how it could end up as NaN).
    Hi again Albert! I set up a test scene and you're right, there's an odd jump that I could almost swear didn't happen before (maybe something changed in Unity 5.3?). However, I can't figure out why it happens, or how to fix it. I'll keep looking, but in the mean time, if you want to experiment with the code yourself, have a look at Chronos/Source/Timelines/AnimatorTimeline.cs. You'll see it uses built-in recording methods. I tried moving the start of the recording to Awake instead, but it throws errors I can't explain.
     
  16. DocMcShot

    DocMcShot

    Joined:
    Mar 18, 2014
    Posts:
    14
    Yes, each of the acorns have a Timeline attached. They are set to Global and the point to the clock that I want them to respond to. The problem I'm having is accessing the gameobjects from the parent script in which they are referenced. I think the problem is simply I can't use Chronos to control time on a referenced object in a script. I think it has to be only the gameobject that the script is attached to. Is that correct? The script isn't actually attached to the acorns.

    I also have a timeline on the branch and it is working as expected.
     
    Last edited: Mar 23, 2016
  17. LazloBonin

    LazloBonin

    Joined:
    Mar 6, 2015
    Posts:
    813
    Looking at your code (the red line pointed by the blue arrow), I see no problem. The deprecated component shortcuts don't matter, because Chronos overrides them with the new keyword (see Timeline.cs, under the Components #section if you're curious about how it's done).

    Are Acorns BaseBehaviours? And is the time property in BaseBehaviour set to be public? What error do you get exactly?
     
  18. DocMcShot

    DocMcShot

    Joined:
    Mar 18, 2014
    Posts:
    14
    The problem was it wouldn't compile. If I started my line with "acorn1.time.*????" it didn't matter what I put after time because it wouldn't compile. I found a work around though. I just made a new script and attached it to each acorn. From there I didn't need to reference the acorn because the script what attached directly to the gameobject.

    If there is a way to do it like I was trying to in the beginning, I'd love to know how. I think it might be useful for the future. Thanks again.
     
  19. LazloBonin

    LazloBonin

    Joined:
    Mar 6, 2015
    Posts:
    813
    I just noticed acorns were GameObjects. Therefore, you can't use the time shortcut, as it's only defined in subclasses of BaseBehaviour. What you should have done instead is:

    acorn.GetComponent<Timeline>().rigidbody2D.isKinematic = false
     
  20. DocMcShot

    DocMcShot

    Joined:
    Mar 18, 2014
    Posts:
    14
    Ahh, thank you!!! That makes sense now that you say it. Thanks again for the awesome product and support!
     
  21. LazloBonin

    LazloBonin

    Joined:
    Mar 6, 2015
    Posts:
    813
    Version 2.4 has been submitted for review!

    Changelog:
    • New TimelineChild component to pass Timeline effects down the hierarchy
    • New occurrence methods that do not require a state transfer parameter
    • Added support for multiple AudioSources per object
    • Allowed modification of rewindable, recordingDuration and recordingInterval at runtime via script
    • Component timelines are now null when the associated component doesn't exist
    • Fixed broken custom recorder inspector
    • Internal architectural changes to accomodate new features
    • Implemented Craft CMS as a website backend
    This version comes with a significant amount of internal changes, both in the plugin and the website, although it should not break any existing code or setup. Please report any bug or unexpected behaviour.
     
    hopeful likes this.
  22. AlbertSwart

    AlbertSwart

    Joined:
    Oct 17, 2015
    Posts:
    15
    Cool. Ok I'll see if I can spot anything but I am not familiar with the animator recording bits yet. Perhaps we can ask the Unity animation guys for an assist?
     
    Last edited: Mar 30, 2016
  23. aspartamed

    aspartamed

    Joined:
    Mar 23, 2016
    Posts:
    7
    I am trying to "jump" back in time. For example if I have a two minute recording and I was at time 1:37, I would like to jump back to 1:25. There doesn't seem to be a native way to do this in Chronos. Am I missing something?

    One approach I am considering is to "reverse time" with a localTimeScale of -12 (the difference between the current time and the objective time), Then restore localTimeScale to 1, in FixedUpdate when the time is 1:25. I guess this would take "1 second" of real time to snap. Which might be a cool effect, but 1 second seems too long.

    alternatively I could take the desired delta time, times the number of Fixed Updates in a second 1/0.02
    Thus my localTimeScale would be -12 * (1/0.02) or -12 *50, or 600; For an instant effect. Or something inbetween.

    Thanks for any tips on how to achieve this in my game!
     
  24. SVC-Games

    SVC-Games

    Joined:
    May 21, 2013
    Posts:
    137
    I believe what you ask was answered in #462:
    "It cannot scrub at any recorded time (what you call "jumping"). For this reason, it can't instantly go back to a specific frame and create the exact same stutter effect. The closest approximation of it would be to quickly switch the time scale between very high and very low values at small intervals, but I doubt it would give out the exact same effect.

    Unfortunately, it's noteasy to hack it in. If it was, I'd have done it long ago! I've been stuck developing a proper replay plugin for months now, but I will keep you all updated if I ever manage to succeed."
     
  25. LazloBonin

    LazloBonin

    Joined:
    Mar 6, 2015
    Posts:
    813
    I tried to grab his attention at Unite, but he seemed quite busy ;). He did mention he would consider some animator features that would improve Chronos functionality (namely bypassing the recording loss on forward).

    Exactly!
     
  26. aspartamed

    aspartamed

    Joined:
    Mar 23, 2016
    Posts:
    7
    I know particle support is relatively new. I am seeing strange behaviors in my particles with Timelines.

    I have a non-looping particle system that does a burst then dies down.

    It behaves fine before I add TimeLines. Bursts then dies down.
    When using chronos times lines and I continue to play it will repeat ever 32 seconds.

    I have another Particle system that shows the same behavior about ever 10 seconds.

    The duration of each is 3 seconds and 1 second respectively. I don't know if that is happenstance or a data point.

    has anyone seen this behavior? Am I doing something wrong? is this a known issue?
     
  27. aspartamed

    aspartamed

    Joined:
    Mar 23, 2016
    Posts:
    7
    Not quite the same, "stutter" implies sub-second resolution. Where I am talking about a grosser implementation. Additionally that questions is "requiring" a instant jump, where I can accept a small rewind window.

    I did a little work on it and now I understand why "Jumping" is not entirely possible.
    If I have a recording from 0 to 30 seconds and I am at time 15, and something that required my game state to change at time 12 occured, and I do a single frame negative time jump to time 5. I wont be able to trigger my event at time 12.

    That prevents jumping back in time (or actually ANY very high rewind/ff rates) and actually can add small time shifts of events.

    So it seems there is an implied max time rate(positive and negative), that is basically
    DesiredTimeResolution = EG 0.5 seconds
    FixedUpdatesPerSecond = EG 50
    DesiredTimeResolution*FixedUpdatesPerSecond = MaxStableTimeRate
    MaxStableTimeRate = 25?

    So you can "surge" to a time at that max rate given your desired time resolution
    That number seems smaller than I expected. Maybe I am missing something?

    Does Chronos have the ability to "trigger" user code at certain times? Or is syncing code events left to be implemented by the user by watching the clocks?
     
  28. LazloBonin

    LazloBonin

    Joined:
    Mar 6, 2015
    Posts:
    813
    This is a "feature", but now that you mention it, I realize it's bugged. Because rewinding particle systems is only possible via complete resimulation, and because this is extremely intensive at high times, Chronos resets them after a configurable number of loops. However, I never took the ParticleSystem.loop property into account when using this hack, so the reset will occur even for non-looping systems. I'll have it fixed for v.2.4.1. In the mean time, if you need an immediate fix, have a look at lines 246-260 in Source/Timelines/ParticleSystemTimeline.cs

    Chronos does have a core system specifically built for triggering and rewinding user code: Occurrences.

    Even the scenario you describe (jumping from t=15 to t=5 with an occurrence at t=12) should work. However, know that when calling that occurrence backwards, in that case, will be done so with the recorded properties set to their value at t=5. Chronos will not "incrementally rewind" between occurrence times over a single frame, because that would make the rewind-update code significantly more complex and slow.

    For this reason, you're right in saying that there is a "maximum stable time rate" at which events occur without any noticeable discrepancy, and while I couldn't say if your calculations for it are right, 25 doesn't seem like an outlandish number. However, at time scales of ± 25, your game does not behave normally; in all fairness, it would be unplayable and uninterpretable, and this is why I don't consider Chronos should support it. Remember that you're essentially trying to "hack in" discrete time jumps, not manipulate time in a continuous fashion, which is the purpose of the plugin.
     
  29. paledust

    paledust

    Joined:
    Sep 1, 2014
    Posts:
    16
    How to get it work if I want to migrant the Timeline into a static class? Because I've already build a lot of function using "Time" inside a static class.
     
  30. LazloBonin

    LazloBonin

    Joined:
    Mar 6, 2015
    Posts:
    813
    Hi Paledust. Unfortunately, this is impossible. If Timeline was a static class, there could only be one time scale across the whole scene, which would render per-object, per-group and per-area time effects impossible. You can use the BaseBehaviour trick with the "time" member shortcut outlined in the tutorial and documentation to minimize the amount of changes needed to your existing code.
     
  31. TonanBora

    TonanBora

    Joined:
    Feb 4, 2013
    Posts:
    493
    Not sure if anyone else has had this problem, or if I am doing something wrong here, but when testing Chronos with the standard assets' rigidbody first person controller, the smaller I set the time scale the larger the character's jump height is.
    This gets to a point where the character basically floats away when the time scale is too small, and the character's speed does not seem to change or slow down, they just stay in the air longer.

    Anyone know why this happens, and how I could fix it?
     
  32. LazloBonin

    LazloBonin

    Joined:
    Mar 6, 2015
    Posts:
    813
    Did you check if the default scripts use Time or Rigidbody methods that would need to be migrated?
     
  33. LazloBonin

    LazloBonin

    Joined:
    Mar 6, 2015
    Posts:
    813
    Version 2.4.1 has been submitted for review!

    Changelog:
    • Fixed editor errors when a Timeline prefab was opened outside a scene with a Timekeeper
    • Fixed non-looping particle systems that were being forcibly looped
    • Significantly reduced garbage allocation from Timelines (now zero in Update andFixedUpdate)
    • Minor website fixes
     
  34. TonanBora

    TonanBora

    Joined:
    Feb 4, 2013
    Posts:
    493
    Ah, i'll make those changes then, but what do I use, if anything, for Rigidbody.Sleep()?
     
  35. LazloBonin

    LazloBonin

    Joined:
    Mar 6, 2015
    Posts:
    813
    Unfortunately, there is no equivalent, because we haven't been able to figure out which calculation Unity truly uses to trigger rigidbody sleeping. See: http://forum.unity3d.com/threads/ho...-normalized-energy-for-sleepthreshold.311941/

    It doesn't really matter, though; everything should behave normally, but there will be a bit less performance optimization in the background.
     
  36. EMOTION-THEORY

    EMOTION-THEORY

    Joined:
    Jul 16, 2013
    Posts:
    83
    How would one go about rewinding to the beginning of the recording period?

    For example: I have recorded 30 seconds. I now want to go back to the beginning of the recording over 1 second. So I want to rewind 30 seconds in 1 second...

    Is there like a timeline, normalized or otherwise, that I can just adjust rather than adjusting the time scale? Almost like a scrubber I guess.

    Cheers!
     
  37. LazloBonin

    LazloBonin

    Joined:
    Mar 6, 2015
    Posts:
    813
    As mentioned very, very often in this thread, Chronos is not a replay plugin. It's not possible to scrub to a specific time or to replay in a forward direction. Have a look at the few posts before yours for some explanations of why.

    (I'm going to put a warning on the website, I've answered this one too many times now!)

    Edit: There it is! http://ludiq.io/chronos/limitations
     
    Last edited: Apr 6, 2016
  38. Seank23

    Seank23

    Joined:
    Aug 4, 2015
    Posts:
    4
    Hi again,
    I recently updated Unity to 5.3.4 and Chronos to 2.41 from 5.2.2 and 2.2 respectively. My game is just about complete but after the update I noticed that the code within all of my backwards delegates would not execute. I get no errors and the code in the forward delegates execute perfectly but when the game is rewound the backwards delegate does not execute. This is huge problem for me as all of the collectables in my game are rewindable and now they do not function correctly. I get no output from debug logs put inside of the backwards delegates.

    Regarding my last issue, thank you for adding the ability to not have to specify a variable to be passed between the delegates. I did however do a rewrite of the code and found that I could just update a local variable and not have to deal with static variables within the occurrence.

    Hope you can help.
    Thanks.
     
  39. LazloBonin

    LazloBonin

    Joined:
    Mar 6, 2015
    Posts:
    813
    D'oh! Terribly sorry about this. I must have broken something either when adding the no-passing version or when optimizing updates. I'll look into it ASAP, but I might not be able to fix it this week (I'm in the middle of university finals etc. and I'm swamped with papers to hand in).
     
  40. Borisss

    Borisss

    Joined:
    Feb 17, 2014
    Posts:
    10
    Hi,

    sorry if this question was already answered:

    I've recently bought your plugin because I like the idea of time based gameplay. I'm just getting to know it. I've decided to create system of clock based pickups/powerups and I've run into problem of AreaClocks being global no matter what the parent clock is set to... I want to be able to change time flow for a set of objects in the scene when they traverse an area but currently it affects all clocks, is that intended?

    my clock hierarchy:
    root
    ->enemy
    ->->typeA
    ->->typeB
    ->player

    when using AreaClock with parent "enemy", it regardless affects all clocks (even root and also player)

    When diving into the source code I can see comment " A Clock that affects every Timeline within its 3D collider" but it is kind of misleading when it derives from Clock that has parent property?

    Is this intended (in that case I don't really see much use for AreaClock) or is it a matter of wrong setup?

    Unity 5.3.4, chronos 2.2

    Regards,
    Boris
     
    Last edited: Apr 17, 2016
  41. Borisss

    Borisss

    Joined:
    Feb 17, 2014
    Posts:
    10
    Additional question:
    would it be possible to record only meaningful changes? E.g. I want to rewind movement of a unit which takes some actions and then is idle for X seconds. When I try to rewind it afterwards, I wait for X seconds before reaching the meaningful action I'd like to rewind (so user sees nothing for a long time after he clicks rewind).

    Would it be possible to either stop/skip recording when I know nothing interesting is going to happen, or just being able to rewind directly from some point in the record?

    Regards,
    Boris
     
  42. marcos

    marcos

    Joined:
    Oct 18, 2009
    Posts:
    592
    Hello,

    Is there a way to record and rewind Playmaker variables, or current states?

    I'm trying to figure out how to record my Global Variables, but can't find any Playmaker options on the custom recorder.

    Would be great if these were exposed for use! :)

    Thanks,
    Mark
     
  43. Borisss

    Borisss

    Joined:
    Feb 17, 2014
    Posts:
    10
    Minor request, question:

    is there a way to have timeline based Terrain? It's probably not supported yet, kind of breaks immersion when in paused world/rewind state grass moves all the same
     
  44. LazloBonin

    LazloBonin

    Joined:
    Mar 6, 2015
    Posts:
    813
    Hi everyone! Just wanted to let you know I'm not forgetting any of you, but I'm extremely busy with university this week and probably won't be able to get back to Chronos development / fixes until April 27-28.

    Since this exists in the API, it should be no trouble to implement it in the next version.
     
  45. Borisss

    Borisss

    Joined:
    Feb 17, 2014
    Posts:
    10
    Hi ludiq,

    first of all good luck with university stuff!

    I've ran into additional problem with navigation (maybe only wrong usage?). I'm using unity's NavMeshAgent that is supposed to be supported according to the homepage. Unfortunately, whenever I pause, rewind agent behaviour gets subsequently broken as his remainingDistance is 0 in next Update.

    I'm having patrolling units and their next destination is set when they arrive at the previous one ( agent.remainingDistance < 0.5f, as there is no event to hook to as far as I know). If you add simple check to Update in your Example scene (ExampleNavigator), it behaves the same (but is harder to see as it is random destination each X seconds).

    This is my code, I guess in this situation (relaying on the navmeshagent being handled by TimeKeeper) I can do the checks in Update, right?

    Code (CSharp):
    1. void Update()
    2.     {
    3.         // Choose the next destination point when the agent gets
    4.         // close to the current one.
    5.         if (agent.remainingDistance < 0.5f)
    6.         {
    7.             ChangeDestination();
    8.         }
    9.     }
    Gameobjects have Timeline, NavMeshAgent and this script attached (see screenshot).

    If my usage is wrong, can you please add some more complex example of handling navigation with Chronos to the package? I think users would appreciate that :).

    Regards,
    Boris
     

    Attached Files:

  46. LazloBonin

    LazloBonin

    Joined:
    Mar 6, 2015
    Posts:
    813
    I'm back! Semester is over. Let's get fixing.


    Hi Sean, (@Seank23)

    I just tested with the example scene (the cube on the right side in Group A), and I cannot reproduce the bug; backward delegates seem to execute. I tried:
    • Occurrences defined in a subclass of Occurrence
    • Delegated occurrences with a parameter
    • Delegated occurrences without a parameter
    Can you send me the code that you're using for occurrences that don't execute? You can PM it if you prefer.

    Hi Boris, (@Borisss)

    The parent property defines how clock time scales are propagated in the clock hierarchy, not what types of timelines get affected in the area clock. For example, setting your area clock's time scale to 0.5, its parent to "enemy", and "enemy"'s time scale to 3, objects within the area clock will have a time scale of 0.5 x 3 = 1.5. I understand the confusion, though; if a timeline set to global mode with enemy as a parent goes through, its time scale will be 3 x 0.5 x 3 = 4.5, which is odd.

    It's extremely rare that area clocks require a parent, but the feature is there. For what you are trying to accomplish, you should use Unity's collision matrix instead. Because area clocks work with colliders, you can set your enemies to an "Enemy" physics layer, your area clocks to an "EnemyAreaClocks" physics layer, then make sure only these two collide in Edit > Project Settings > Physics. The tutorial goes over this process for making sure only enemies get caught in a trap. Here's the link: http://ludiq.io/chronos/tutorial#areaclock

    Unfortunately, that's not within the scope of what Chronos does: continuous time scale manipulation. It would be possible with a proper replay plugin which, as I've mentioned quite often in this thread, is in the works, but hard to complete.

    That's a great suggestion! It's a bit complicated, though. I've added it in my todo list and will try to take a crack at it in the following weeks.

    I added it in v.2.4.2 but it seems like TerrainData.wavingGrassSpeed property is bugged (it doesn't affect the speed at all... seems to affect an offset or something like that). I've submitted a bug report: https://fogbugz.unity3d.com/default.asp?792963_8chcc655iiadp9vr

    This will be fixed when pausing in v.2.4.2. However, it won't be for rewind, because it wouldn't make sense. When you stop a rewind midway, there's no guarantee you want the navMeshAgent to have the same destination it had when it was at that point before. This is similar for physics: when you rewind physics, Chronos doesn't guarantee they'll replay exactly the same the second time; that's up to your code. In other words, Chronos isn't a replay plugin. Therefore, if you rewind, then let time flow normally, your NavMeshAgents have no destination anymore; they "forget" it. It's normal that they would re-assess their state, in comparison with other agents in the scene, to figure where they go from there, so the fact that remainingDistance is zero is not a bug.
     
  47. LazloBonin

    LazloBonin

    Joined:
    Mar 6, 2015
    Posts:
    813
    Version 2.4.2 has been submitted for review!

    Changelog:
    • Fixed NavMeshAgents losing their destination after pausing
    • Added groundwork for terrain grass speed effect (bugged in Unity for the moment)
     
  48. Borisss

    Borisss

    Joined:
    Feb 17, 2014
    Posts:
    10
    @ludiq thanks for timely response

    Btw how long does it usually take for update to go live?

    According to bug report, there seems to be some reply already so that can be included in next, next update ;)

    Regading the navigation, I'm not talking about full rewind (before the point where I set the destination), just set destination, play forward for 10s rewind for 4s and play again, this should pertain the destination, right (it doesn't make sense to just dissapear)? Chronos just does timeline scaling, if I'm the only one setting destination (based on some logic that doesn't necessarily be based on the current state of the world (which can be affected by rewinding)) I expect it not to be overwritten when I do the small rewind/play loop (who overwrites it?).

    But if that is a problem, how should I workaround that? Some occurence for speed being set to play again? Maybe some small code snippet to showcase it?

    regading AreaClocks, I've done small script update to work as I expected it and it seems to be ok:

    Code (CSharp):
    1. /// <summary>
    2. /// ex: making sure we affect only given hierarchy part of clocks/timelines!
    3. /// </summary>
    4. public class AreaClockEx : AreaClock3D {
    5.  
    6.     protected override void OnTriggerEnter(Collider other)
    7.     {
    8.         if (!enabled)
    9.         {
    10.             return;
    11.         }
    12.  
    13.         Timeline timeline = other.GetComponent<Timeline>();
    14.  
    15.         if (timeline != null && CheckClockHierarchy(timeline.clock))
    16.         {
    17.             // Store local coordinates to account for dynamic changes of the clock's transform
    18.             Vector3 entry = transform.InverseTransformPoint(other.transform.position);
    19.  
    20.             Capture(timeline, entry);
    21.         }
    22.     }
    23.  
    24.     /// <summary>
    25.     ///
    26.     /// </summary>
    27.     /// <param name="clock"></param>
    28.     /// <returns></returns>
    29.     protected bool CheckClockHierarchy(Clock clock)
    30.     {
    31.         do
    32.         {
    33.             if (clock == parent) return true;
    34.  
    35.             clock = clock.parent;
    36.         }
    37.         while (clock != null);
    38.  
    39.         return false;
    40.     }
    41. }
    It's a new class to avoid being lost with new version of your plugin.

    Regards,
    Boris
     
  49. FG_dev1

    FG_dev1

    Joined:
    Nov 3, 2014
    Posts:
    44
    Hi, lidiq

    I have an issue I'm hoping you can help me with.

    I have a ragdoll that has is made up of rigidbodies, colliders and (global) Timelines. All of the ragdoll's GameObjects are turned off at startup. once an enemy is dead I activate the ragdoll's game objects and instantly push the ragdoll using timeline.rigidbody.AddForce().

    The issue is the Timeline has been off since it was created so it's Update() doesn't run to compute the timescale. So the rigidbody is thrown with a timescale of 1 when it should be lower (when in slow mo).

    Is there a way around this? Or a nice easy way to calculate the Timescale for the timeline once I turn on the ragdoll?

    Having the ragdoll's objects be off is a necessity as the ragdoll spazz's out when using just isKinematic (it's a unity thing)

    Thanks
     
  50. LazloBonin

    LazloBonin

    Joined:
    Mar 6, 2015
    Posts:
    813
    Hi! It seems like Timeline.ComputeTimeScale() might be what you're looking for. Also, don't forget that every rigidbody in the ragdoll needs its own Timeline or TimelineChild component. (Can't link to the specific documentation right now, I'm on my phone, but it's all in http://ludiq.io/chronos/documentation)