Search Unity

Chronos – Time Control – Unity Awards Winner

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

  1. FG_dev1

    FG_dev1

    Joined:
    Nov 3, 2014
    Posts:
    44
    That sounds like what I need but Timeline doesn't have a function called ComputeTimeScale() :( That's only on "Clocks" (as far as I can tell/according to the documentation and compiler). Is there a way for a "Timeline" to compute/update its timeScale via public function?

    And yeah I have a timeline for each rigidbody on the ragdoll

    Thanks

    Edit: It seems that using the below (which I think is what you meant before)

    Code (CSharp):
    1. GetComponent<Chronos.Timeline>().clock.ComputeTimeScale();
    Has the desired result but I assume this is recalculating all the timelines , is there a way for it just to work on just the desired Timelines? (Just to save the unnecessary overhead since I know which Timelines that need to be updated)
     
    Last edited: May 3, 2016
  2. Borisss

    Borisss

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

    so in 2.4.2 you can add Timeline to Terrain object and make grass animation timescaled with this simple update to TerrainTimeline.cs (use wavingGrassStrength instead of speed as unity has it wrongly mapped):

    Code (CSharp):
    1.  
    2. public override void CopyProperties(Terrain source)
    3. {
    4. _wavingGrassSpeed = source.terrainData.wavingGrassStrength;
    5. }
    6.  
    7. public override void AdjustProperties(float timeScale)
    8. {
    9. component.terrainData.wavingGrassStrength = wavingGrassSpeed * timeScale;
    10. }
    11.  
    @ludiq though I still find it weird for NavMeshAgent to not be rewindable out of the box (isn't pausing [which you added now] also only manipulation with timeScale, the same as rewind, fast forward etc?), I've made workaround using script recorder for that navigation problem.
    Btw I've noticed that CustomRecorder ignores public properties/variables from parent classes (in my case abstract parent) so I've coded my own recorder to circumvent that.
     
  3. LazloBonin

    LazloBonin

    Joined:
    Mar 6, 2015
    Posts:
    813
    D'oh, right! But don't worry, that shouldn't have a negative effect on performance. Timelines don't calculate their watched clock's time scale, they simply copy it.

    Indeed, Unity hadn't answered my bug report with that substitution by the time I decided to publish v.2.4.2. I won't fix it myself for now, because it would break whenever Unity fixes their own bug, but your workaround is correct.

    As for the destination recording: it's a matter of design principle. If I can't guarantee a forward action will execute as it did for the first time for one type of object (e.g. rigidbodies don't necessarily fall in the same way every time), I can't enable it for another (e.g. nav mesh agents going to their previous destination).

    For example, let's say you rewind every enemy in the scene, but not the player, which is a perfectly valid use case for Chronos. Since the enemies are agents that converge towards the player, their destination needs to be updated to match the player's. However, if you rewind past to a point where the player was elsewhere, and recorded/replayed the destination, the enemies would not aim for the player on forward, but instead for a previous position of it. This is unintended behaviour, because it's outside the scope of Chronos: predicting how objects should behave while time is going forward.

    If you absolutely need that feature in your specific scenario, for example if you always rewind the scene as a whole, then yes, a custom recorder set to NavMeshAgent.destination should work. I'll look into the parent property bug and try to get it fixed for v.2.4.3.
     
  4. BAnyBudde

    BAnyBudde

    Joined:
    Jun 3, 2014
    Posts:
    51
    Hey this is a great package, I have only one problem with it. I use Playmaker and SWS Plugins, and all works great with Playmaker and the actions, unfortunately with SWS all my objects that are moving along paths just will not slow down or adjust to any Global clocks, is there any way around this? Many thanks for the great product
     
  5. LazloBonin

    LazloBonin

    Joined:
    Mar 6, 2015
    Posts:
    813
    I used SWS for the video trailer, so it's definitely compatible. I don't remember exactly where (and I don't have that specific project handy at the moment), but there should be a speed parameter in the splineMove components. Set this parameter to yourDesiredSpeed * timescale, where timescale is a clock's time scale, and Chronos should take care of the rest.
     
  6. buttmatrix

    buttmatrix

    Joined:
    Mar 23, 2015
    Posts:
    609
    Quick question:

    We have a simulation in MatLab using Simulink to control the motion of a gameobject. At runtime, the gameobject's transform / rotation updates every frame and moves according to the simulation. Can I use Chronos to record the gameobject's motion at runtime, save the motion as an animation (or some such), and play it back whenever we'd like?
     
  7. LazloBonin

    LazloBonin

    Joined:
    Mar 6, 2015
    Posts:
    813
    Unfortunately, Chronos is not a replay plugin.
     
    buttmatrix likes this.
  8. NashBits

    NashBits

    Joined:
    Dec 10, 2013
    Posts:
    9
    I'm a bit confused about how Area Clock's are supposed to be set up to get their "contents" to rewind along with a Global Clock.

    Consider this scenario:
    Bullets fired (each with a timeline pointing to a global Bullets clock). Bullets use occurrences to spawn/despawn.
    Area Clock catches the Bullets in slow-mo.
    Rewind Bullets clock...

    In my current build, built closely after the tutorial, the bullets trapped in the Area Clock continue moving forward in slow-mo, but are still destroyed as though the occurrence does take place.

    Am I doing something wrong?
     
  9. LazloBonin

    LazloBonin

    Joined:
    Mar 6, 2015
    Posts:
    813
    Let me make sure I understand: your bullets move at a time scale between 0 and 1, but their occurrences seem to trigger as if the time scale was < 0, right?

    That would be a bug. Can you:
    • Test that in the example scene, the occurrence example (the rightmost cube in the first section) behaves correctly with its occurrences (changing color) and the area clocks?
    • Disable the area clock in your scene and see if things behave correctly without it?
    • Send me the code you're using to schedule the occurrence or any other code that may be interfering.
     
  10. BAnyBudde

    BAnyBudde

    Joined:
    Jun 3, 2014
    Posts:
    51
    Legend, thanks for the reply, will try this out soon!
     
  11. StephenMorris

    StephenMorris

    Joined:
    Mar 25, 2013
    Posts:
    35
    Sorry if this sounds a little silly but how exactly do you access properties such as rigidbody.isKinematic? Attach baseBehaviour then call through there? Any attempt I'm making is coming up with access errors.

    Many thanks,
    Stephen
     
  12. LazloBonin

    LazloBonin

    Joined:
    Mar 6, 2015
    Posts:
    813
    It's on the Timeline component. Try GetComponent<Timeline>().rigidbody.isKinematic.

    Edit: if your script inherits from BaseBehaviour, then you can use time.rigidbody.isKinematic instead.
     
    Last edited: Jun 2, 2016
  13. arnesso

    arnesso

    Joined:
    Mar 3, 2015
    Posts:
    96
    hi,
    I try to create a time grenade with UFPS and Chronos. I made an AI movement script(.cs) I also created Timekeeper, a prefab with area clock( this is greande) I modified the time to 0.2 in the area clock. and I attached this little script to my Player :
    Where should I write the animation, and navmesh speed influence script ? Into this TImeSkill script or where?

    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3. using System.Collections.Generic;
    4. using Chronos;
    5.  
    6. public class TimeSkill : MonoBehaviour {
    7.  
    8.     // Use this for initialization
    9.  
    10.  
    11.     // Update is called once per frame
    12.     void Update () {
    13.  
    14.         Clock clock = Timekeeper.instance.Clock("Enemy");
    15.         if(Input.GetKeyDown(KeyCode.K))
    16.         {
    17.             clock.localTimeScale = 0.2;
    18.  
    19.  
    20.         }
    21.         else if(Input.GetKeyDown(KeyCode.L))
    22.         {
    23.             clock.localTimeScale = 1;
    24.          
    25.         }
    26.  
    27.     }
    So I want to make a throwable object with area clock where th AI will be slower
    Thank you :)
    cheers
     
  14. LazloBonin

    LazloBonin

    Joined:
    Mar 6, 2015
    Posts:
    813
    Hi Arnesso!

    You don't need to write a script to influence the animator or nav mesh agents; Chronos will take care of it automatically. Simply attach a Timeline component to the objects that should be affected (in your case: the enemies), set to "Global > Enemy".

    For them to be triggered in the grenade's area of effect, you'll need to setup colliders properly. I suggest you have a look at the last part of the tutorial, which covers exactly this use case: http://ludiq.io/chronos/tutorial#AreaClock
     
    arnesso likes this.
  15. FG_dev1

    FG_dev1

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

    I'm having trouble applying Torque to Timeline.rigidbodies on a ragdoll.

    I had a similar issue with AddTorque, so again 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.AddTorque().

    I'm calling ComputeTimeScale(); before trying to apply Torque and I can push the ragdoll with AddForce so it responding just not to any AddTorque().

    Any ideas why this might be?

    Thanks
     
  16. berkpanteon

    berkpanteon

    Joined:
    Jun 7, 2016
    Posts:
    6
    I have a huge problem. In my puzzle game, there are some cars and they crash when player hits play. To avoid crashes, there are Area Clocks. Player can slow or speed up the time and cars don't crash. Player also can increase-decrease the Global Clock in scene.
    Problem starts when area clock and global clock both speed up. Cars behave differently and sometimes doesn't crash even if they had to. This messes up the whole game. Is there a way to avoid this? I must use Global and Area clocks speeded up at the same time.

    Edit: This problem occurs when I test the game on a tablet with low frame rate. In computer, there are no problems.
     
    Last edited: Jun 10, 2016
  17. LazloBonin

    LazloBonin

    Joined:
    Mar 6, 2015
    Posts:
    813
    Hm, this is very odd. I just created a test scene, and torque is just behaving completely unpredictably. I'll keep testing and trying to make adjustments.

    Are you sure this is a Chronos related problem, and not simply a Unity physics problem? If Chronos speeds up the physics and your framerate is too low, collision detection may go wrong. Does setting your Collision Detection mode in your rigidbodies to something else than discrete? See the Unity documentation here: https://docs.unity3d.com/ScriptReference/Rigidbody-collisionDetectionMode.html
     
  18. berkpanteon

    berkpanteon

    Joined:
    Jun 7, 2016
    Posts:
    6
    It's not about Collision Detection. When I speed up the Global Clock and a car passes through a speeded up Area Clock, it moves faster than usual and cars avoid crash. They don't hit each other because their velocity increases. I think it's related to Chronos since this problem doesn't occur if I speed up Global Clock or Area Clock not at the same time in a device with low frame rate.
     
  19. FG_dev1

    FG_dev1

    Joined:
    Nov 3, 2014
    Posts:
    44
    Can you let me know the results/when it's fixed please. Got a few things waiting on this.

    Thanks
     
  20. rerwandi

    rerwandi

    Joined:
    Dec 8, 2014
    Posts:
    544
    Just want to know,
    how is your replay plugins mate ? :)
     
  21. LazloBonin

    LazloBonin

    Joined:
    Mar 6, 2015
    Posts:
    813
    I will work on it this weekend.

    Development is on hiatus for the moment.
     
  22. berkpanteon

    berkpanteon

    Joined:
    Jun 7, 2016
    Posts:
    6
    I think I have solved the problem. As default in Unity, Max Allowed Time in Time Manager is 0.3333 so when frame rate is low, fixed updated called less frequenty. I changed it to 0.02 and problem solved. Probably Chronos lowered the frame rate on a cheap device so game behaved differently.
     
  23. LazloBonin

    LazloBonin

    Joined:
    Mar 6, 2015
    Posts:
    813
    Glad you solved the problem. Out of curiosity, were you using Timeline.fixedDeltaTime in your fixed updates?
     
  24. berkpanteon

    berkpanteon

    Joined:
    Jun 7, 2016
    Posts:
    6
    No, I didn't use Timeline.fixedDeltaTime anywhere. By the way problem occured again even on computer. When I speed up the time, cars crash even they are not supposed to. I think messing up with time also messes up Unity so it behaves differently. If you have any recommendations I can listen :D
     
  25. LazloBonin

    LazloBonin

    Joined:
    Mar 6, 2015
    Posts:
    813
    Hi FG_Dev1,

    Sorry I couldn't get to your issue last week as intended. Upon further testing, I don't see any problem with Chronos' implementation of AddTorque. In other words, the angular velocities are directly proportional to the time scales.

    How exactly are you using AddTorque? It should:
    • Use timeline.rigidbody.AddTorque instead of rigidbody.AddTorque
    • Be called in either Update or FixedUpdate
    • Have ForceMode.Impulse (or Force.VelocityChange to ignore mass) for instant effect
    • Still be multiplied by timeline.deltaTime
    Sometimes, too, we tend to use torque values that are too small for the effects we try to achieve. As a last resort, try boosting that value.

    For reference, here are the tests I've run to confirm the implementation in Chronos is correct.



    The first two cubes apply continuous torque (at every fixed update). The last two cubes apply an impulse torque on key press. In each subset of two cubes, the first one doesn't use Chronos, but the second one does. The last line of the debug compares their angular velocity to the "vanilla" torque. The Chronos time scale is set at 3 and the comparison returns exactly this value (notwithstanding floating point imprecisions), meaning that Chronos behaves correctly. (The position constraints are enabled on all rigidbodies to keep them from falling in the void; we just want to test torque, after all, so only rotation matters).

    Here is the script used for testing:

    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3. using Chronos;
    4. using UnityEditor;
    5.  
    6. [RequireComponent(typeof(Rigidbody), typeof(Timeline))]
    7. public class TestAddTorque : MonoBehaviour
    8. {
    9.     public float torque = 1;
    10.     public bool useChronos;
    11.     public bool fixedUpdate;
    12.     public bool reapplyDelta;
    13.     public bool continuous;
    14.     public ForceMode forceMode;
    15.     public Rigidbody reference;
    16.  
    17.     private Timeline timeline;
    18.     private new Rigidbody rigidbody;
    19.  
    20.     void Awake()
    21.     {
    22.         timeline = GetComponent<Timeline>();
    23.         rigidbody = GetComponent<Rigidbody>();
    24.     }
    25.  
    26.     void Update ()
    27.     {
    28.         if (!fixedUpdate)
    29.         {
    30.             Apply();
    31.         }
    32.     }
    33.  
    34.     void FixedUpdate()
    35.     {
    36.         if (fixedUpdate)
    37.         {
    38.             Apply();
    39.         }
    40.     }
    41.  
    42.     void Apply()
    43.     {
    44.         if (continuous || Input.GetKeyDown(KeyCode.A))
    45.         {
    46.             if (useChronos)
    47.             {
    48.                 var multiplier = reapplyDelta ? (fixedUpdate ? timeline.fixedDeltaTime : timeline.deltaTime) : 1;
    49.                 timeline.rigidbody.AddTorque(transform.up * torque * multiplier, forceMode);
    50.             }
    51.             else
    52.             {
    53.                 var multiplier = reapplyDelta ? (fixedUpdate ? Time.fixedDeltaTime : Time.deltaTime) : 1;
    54.                 rigidbody.AddTorque(transform.up * torque * multiplier, forceMode);
    55.             }
    56.         }
    57.     }
    58.  
    59.     void OnDrawGizmos()
    60.     {
    61.         if (Application.isPlaying)
    62.         {
    63.             var label = name;
    64.             label += "\n\n";
    65.             label += "\n\n" + "Torque: " + torque;
    66.             label += "\n\n" + "Use Chronos: " + useChronos;
    67.             label += "\n\n" + "Fixed Update: " + fixedUpdate;
    68.             label += "\n\n" + "Reapply Delta: " + reapplyDelta;
    69.             label += "\n\n" + "Continuous: " + continuous;
    70.             label += "\n\n" + "Force Mode: " + forceMode;
    71.  
    72.             if (reference != null)
    73.             {
    74.                 var comparison = rigidbody.angularVelocity.magnitude / reference.angularVelocity.magnitude;
    75.                 label += "\n\n";
    76.                 label += "\n\n" + "Ang. velocity comparison: ";
    77.                 label += "\n\n" + comparison;
    78.             }
    79.  
    80.             Handles.Label(transform.position + new Vector3(-0.5f, -0.7f, -0.7f), label);
    81.         }
    82.     }
    83. }
    84.  
     
  26. Kk_radford

    Kk_radford

    Joined:
    Dec 20, 2012
    Posts:
    31
    Hi great Plug-in! loving it. I have a problem I hope someone can help me with:

    I have two clocks in my scene: one at timeScale 0 and one at timeScale 1. I make gameObjects' TimeLine componants switch between the two clocks based on a collision. So in run time, a collision is changing a gameObject's clock to a frozen one and back again. Freezing the gameObject and un-freezing it accordingly.

    This works for some of my objects, but not for others and I cannot figure out why.
    the problematic GameObjects are identical except for the fact they have certain componants added during run-time instead of being added beforehand in the editor. Would this make a difference? Objects are physics enabled with RigidBodys.

    Is this the best way to achieve what I am achieving? I feel like it mightn't be.
     
  27. Kk_radford

    Kk_radford

    Joined:
    Dec 20, 2012
    Posts:
    31
    I actually figured out my problem, I was instantiating the timeline component before the Rigid body, once I switched that instantiation order around everything works as expected! Great plug in!
     
  28. LazloBonin

    LazloBonin

    Joined:
    Mar 6, 2015
    Posts:
    813
    Glad you fixed it!

    If ever you have problems with runtime-instantiated components, just remember to call CacheComponents on the Timeline after creating them. See: http://ludiq.io/chronos/documentation#timeline.CacheComponents
     
    Kk_radford likes this.
  29. phoenixrising

    phoenixrising

    Joined:
    Aug 9, 2013
    Posts:
    57
    Hi, I am new to chronos and I am having a little difficulty understand why it seems the physics forces are behaving strangely.

    I have a sphere that follows a gameobject

    timeLine.rigidbody.isKinematic=true;
    timeLine.rigidbody.useGravity=false;

    then when time to add force I do this

    timeLine.rigidbody.isKinematic=false;
    timeLine.rigidbody.useGravity=true;
    timeLine.rigidbody.AddForce( new Vector3(0,100f,300f),Impulse);

    When I do this with the timeLine component, it does not have the same trajectory as when I do everything with a unity rigidbody which behaves as anticipated.

    When I do it with the timeLine the sphere seems to go straight down with a lot of force in the -y

    Like I say I am new to this asset and I think I might be missing something obvious?

    I noticed that the velocity never gets changed on RigidbodyTimeline3D
    so I tried to add some code to fix this but it is still not working for me.

    It seems the physics gravity force is too much and/or the force I add is not being applied or is too small or something?

    public override void FixedUpdate()
    {
    if(useGravity&& !component.isKinematic&&timeline.timeScale>0)
    {
    velocity+=(Physics.gravity*timeline.fixedDeltaTime);
    }
    else{
    velocity=Vector3.zero;
    }
    }
     
    Last edited: Jul 22, 2016
  30. Kk_radford

    Kk_radford

    Joined:
    Dec 20, 2012
    Posts:
    31
    Actually I'm having some trouble using this, I am trying to add a TimeLineChild during run time and it does not seem to work for me, even after calling cacheParent() & CacheComponents(). I am receiving the following error after trying to call those two methods:

    ChronosQuestion.PNG

    My code currently looks like this:

    Code (CSharp):
    1. void Update () {
    2.     if (Input.GetKeyDown("space"))
    3.         {
    4.             tlChild = gameObject.transform.GetChild(0).gameObject;              //child Object with the TimeLine child component
    5.             gameObject.GetComponent<Timeline>().CacheComponents();              //clears the parent object's component Cache
    6.             tlChild.GetComponent<TimelineChild>().CacheComponents();            //clears child's component cache
    7.             tlChild.GetComponent<TimelineChild>().CacheParent();                //clears the child's parent cache
    8.             print("Timeline Caches Cleared");
    9.         }
    10.     }
    I am trying to pause and resume a particle system that is on the child object in tandem with it's parent.

    Any help would be greatly appreciated, any idea what this error is telling me? or why the child's timelineChild object ignores it's parent even after clearing both of it's caches?
     
  31. LazloBonin

    LazloBonin

    Joined:
    Mar 6, 2015
    Posts:
    813
    Sorry for the lack of replies, swamped with work again. I'll try to get to your issues this weekend.
     
  32. LazloBonin

    LazloBonin

    Joined:
    Mar 6, 2015
    Posts:
    813
    From that error, it seems like your recording duration is set to zero. Is that the case? If so, try to put it to any value (e.g. 1 second), and disable "rewindable" instead. If that fixes it, I'll simply add a check and warning for this.
     
  33. LazloBonin

    LazloBonin

    Joined:
    Mar 6, 2015
    Posts:
    813
    Removing all velocity when there is no gravity doesn't really make sense (otherwise, without gravity, no object could ever move, e.g. in a space game).

    From your description, I don't know where the issue is coming from. Could you send me a test project where that bug occurs? Please isolate to the minimum (e.g. just your sphere following a cube).
     
  34. Arganth

    Arganth

    Joined:
    Jul 31, 2015
    Posts:
    277
    am i the only one who gets this?

    PlayerSettings Validation: Requested build target group (16) doesn't exist; #define symbols for scripting won't be added.
    UnityEditor.PlayerSettings:SetScriptingDefineSymbolsForGroup(BuildTargetGroup, String)
    Chronos.Addon:AddDefine() (at Assets/Chronos/Source/Utilities/Editor/AddonDetector.cs:117)
    Chronos.Addon:Check(Boolean) (at Assets/Chronos/Source/Utilities/Editor/AddonDetector.cs:65)
    Chronos.AddonDetector:CheckForAddons(Boolean) (at Assets/Chronos/Source/Utilities/Editor/AddonDetector.cs:31)
    Chronos.AddonDetector:OnPostprocessAllAssets(String[], String[], String[], String[]) (at Assets/Chronos/Source/Utilities/Editor/AddonDetector.cs:46)
    UnityEditor.HostView:OnGUI()
     
  35. jamesbdh

    jamesbdh

    Joined:
    Sep 22, 2015
    Posts:
    7
    This is looking like the right asset for me, just want to clarify something. If I wanted to have the playback speed change smoothly depending on say, a gui slider or the x-axis of a controller, is that possible?
     
  36. Kk_radford

    Kk_radford

    Joined:
    Dec 20, 2012
    Posts:
    31
    No, I don't think that's it, I have recording enabled, are you saying I should turn it off?

    This is my Timeline component that I add while the game is playing:

    chronosTimeLineComponent.PNG

    This is the code I'm trying to execute:

    Code (CSharp):
    1. void Update () {
    2.     if (Input.GetKeyDown("space"))
    3.         {          
    4.             gameObject.GetComponent<Timeline>().CacheComponents();              //clears the parent object's component Cache          
    5.             print("Timeline Caches Cleared");                                                                              
    6.         }
    7.     }
    When I run this code I suddenly start to get a NullReferenceException from a different script that is looking for a Rigidbody that is on the same object as both the TimeLine and this Script. This exception wasn't there before the cacheComponents() call, and If I leave the game running for another few seconds after the call, I also start to get the exception I posted about earlier, the 'ArgumentOutOfRange' error.

    I am no longer trying to get the child Timeline working with a particle system, just the regular CacheCompents() on the parent's TimeLine.

    My problem now is that I cannot get a sudden velocity change using 'TimeLine.RigidBody.Velocity = new Vector3' to work on the game object. I thought adding the TimeLine component at run time and not clearing the cache might be the issue, as it does seem to work on objects that have all this set up before I enter play mode, but obviously I'm doing it wrong cause I'm getting a life time supply of errors here.

    My console looks like this a few seconds after the call: ChronosQuestion2.PNG

    Edit: layout/grammer
     
  37. Massive-Brain

    Massive-Brain

    Joined:
    Dec 17, 2014
    Posts:
    2
    OK i have that weird problem i'm trying to make the enemies move slowly when the player ability activated and to do so i have to inherit baseBehavior class but the problem that i'm already inheriting a class called living which have the health data the damage the take hit and some other physics stuff so i need a way to inherit the tow class cus unity don't support multiple class inheriting any more

    also i have question is't there simple way to add the asset to all the game object accept lets say the player cus that's really what all i need player activate the ability every thing become slower but the player move in the same speed and doing so for every prefab is time consuming especially when you need to edit almost every physics line in the scripts thanks in advance great asset by the way fantastic jop
     
  38. LazloBonin

    LazloBonin

    Joined:
    Mar 6, 2015
    Posts:
    813
    That's very odd, but it's completely harmless. Do you have some custom build setup for a device? There shouldn't be a build target #16, Unity only has 15 and I'm iterating over them while enabling/disabling the PlayMaker integration. See: https://docs.unity3d.com/ScriptReference/BuildTargetGroup.html

    You can definitely control the time scale smoothly with any float. The example scene included in the package uses UI sliders. However, Chronos is not a replay plugin, so I'm not sure what you mean by "playback".

    I'm not sure what is your current issue anymore.
    First, you only need to call CacheComponents if you add or remove components affected by Chronos at runtime. It will clear the recorded data.

    That ArgumentOutOfRangeException can only happen if your Timeline's snapshot capacity is at 0, which is theoretically impossible unless your recording duration is set to zero. Your 1/30 setup is fine, so I'm not sure what's happening.

    Is it possible that you're adding the rigidbody component, calling CacheComponents, and then immediately setting the velocity? In other words:

    Code (CSharp):
    1. myGameObject.AddComponent<Rigidbody>();
    2. myGameObject.GetComponent<Timeline>().CacheComponents();
    3. myGameObject.Getcomponent<Timeline>().rigidbody.velocity = /*...*/;
    Please send me some project files where the issue you describe is isolated, it would truly help me help you. :)

    You don't have to inherit BaseBehaviour, it's just a shortcut. You can skip it and use GetComponent<Timeline>() instead of time in your scripts. Or, you could make your living class inherit BaseBehaviour, like so:

    Enemy : Living : BaseBehaviour

    You can easily add timelines to the prefabs of your enemies / props so that they are propagated through the scene, or you can find all objects you'd like to be affected by Chronos through scripting at the beginning of the scene and add a timeline component to them. An example of this is found in the documentation here: http://ludiq.io/chronos/documentation#timekeeper.Examples
     
  39. jtaala

    jtaala

    Joined:
    Aug 23, 2016
    Posts:
    1
    Hi Ludiq, very interested in buying and using CHRONOS in my project. My project is essentially visualisation of a simulation system we use. It's progressed somewhat and functional but I'm having issues with fast-forwarding using unity's timeScale. Main issue is that it's limited to 100x (e.g. can only be 0 to 100). Does CHRONOS have any way of setting timeScale to values greater than 100 or is it still limited to unity's timeScale constraints?

    JT.
     
  40. daniozi117

    daniozi117

    Joined:
    Mar 4, 2016
    Posts:
    27
    Yesterday i bought this package. I just want to rewind and forward my car not accelerate. The rewind is good but there is no option to obtain its position where the rewind starting position.
     
  41. LazloBonin

    LazloBonin

    Joined:
    Mar 6, 2015
    Posts:
    813
    Hi Daniozi!

    This position is not publicly exposed in the API because Chronos isn't a "replay" plugin, and therefore usually you shouldn't "need" to know where the rewind started. If you absolutely need it, you can make line 53 in Chronos / Source / RecorderTimeline.cs public instead of protected, then query the first one with GetComponent<Timeline>().transform.snapshots[0].position. If your car has a rigidbody, use .rigidbody. instead of .transform.

    However, I must stress that Chronos is not a replay plugin. It will not be able to play your rewinded data in forward after the rewind.
     
  42. LazloBonin

    LazloBonin

    Joined:
    Mar 6, 2015
    Posts:
    813
    In case you missed it, Chronos is 40% OFF this week in the Unity Asset Store Madness sale!



    Grab it while it lasts! ↓ ↓ ↓

    Asset Store Link
     
    Last edited: Aug 24, 2016
  43. tnaseem

    tnaseem

    Joined:
    Oct 23, 2009
    Posts:
    149
    I've had Chronos for quite some tie now, and only started to use it today! Works great, but I have an issue with rigidbody's not behaving quite right. I'll explain below:

    I have a ball object with a rigidbody applied to it in the Inspector, along with a timeline component (set to a global 'Balls' clock).

    I drop the ball from around 10m in the air to bounce on the floor, which works great regardless of timescale.

    However, the issue arises when it collides with another moving rigidbody...

    With a timeScale of 1, it collides with other rigidbody's as normal. However, when I change this scale to something other than 1, say 0.5, it looks like it's had a larger force applied and goes a LOT further after impact; still in 'slow motion', but it seems as if the force has been increased on impact.

    The rigidbody it's colliding with also has a timeline component. I've tried both ball and this with timelines linking to the same global clock and to separate ones. However, I still get the same results.

    One thing I did try was to add a script to the ball object and apply a force in OnCollisionEnter, using timeline.rigidbody.AddForce. However, as suspected, this just Adds the force to the existing one it's already reacting to. Doesn't seem a way of intercepting this to make things work properly.

    Is this just a limitation that Chronos is experiencing with Unity physics, or am i doing something wrong? I know someone else earlier posted issues with 4 cubes at different timescales not bouncing the same. I wonder if this is the same thing, but with bigger forces.

    Hope this makes sense!
     
  44. Hakazaba

    Hakazaba

    Joined:
    Jul 1, 2015
    Posts:
    119
  45. Otavio_Soato

    Otavio_Soato

    Joined:
    May 28, 2014
    Posts:
    4
    Hello guys and @ludiq,
    I updated my unity to version 5.4 and now I have an issue with Physics2D.isTouching. The return of isTouching method is only true when my timekeeper timescale is negative. Does anyone know how to solve this problem?

    Otavio.
     
  46. LazloBonin

    LazloBonin

    Joined:
    Mar 6, 2015
    Posts:
    813
    Hi everyone,

    A quick message to let you know I haven't forgotten this thread. I've been very busy as our studio is announcing our game on Greenlight this week; I didn't plan for the sale (and the influx of new customers with questions!) to happen at the same time.

    I'll get back to fixing issues and answering questions about Chronos as soon as possible.

    Cheers!
     
    tnaseem likes this.
  47. ZeldaS

    ZeldaS

    Joined:
    Jul 3, 2013
    Posts:
    3
    Last edited: Sep 1, 2016
  48. SkygodGames

    SkygodGames

    Joined:
    Feb 23, 2014
    Posts:
    18
    Does anyone know every how I can fix this issue with the AnimatorController.


    Assets/Chronos/Source/Dependencies/Reflection/Editor/AnimatorParameterDrawer.cs(176,74): error CS0030: Cannot convert type `UnityEngine.RuntimeAnimatorController' to `AnimatorController'
     

    Attached Files:

  49. Blue-Wolf

    Blue-Wolf

    Joined:
    May 27, 2014
    Posts:
    20
    Hi Ludiq,

    Do you know if Chronos plays nice with the Spine (animation software) runtime for Unity?

    Best of luck on your Greenlight campaign!
     
  50. LazloBonin

    LazloBonin

    Joined:
    Mar 6, 2015
    Posts:
    813
    Hi JT, sorry for the late reply.

    Chronos has no hard limit on the time scale, but be aware that all it is doing behind the scenes is multiplying the update values; it's not adding any more update cycles. For game purposes, this is perfectly fine, but for scientific visualisation or simulation, it's inaccurate.

    Hi tnaseem, thanks for the detailed bug report.

    This is a very interesting issue. Could you please isolate it and send over a test project by private message? I'm afraid I might be limited by how Unity physics work, but I would definitely want to get this fixed, I consider it to be a bug.

    If everything goes well, I might have some time to work on the replay plugin in November / December, but this isn't guaranteed. If your studio needs replay capabilities immediately, perhaps it's best to develop them yourself.

    Hm, that's odd. Are you using Unity 5.4? Maybe they did a breaking change in their API.
    Can you open the file at the line of the error and replace it with:

    Code (CSharp):
    1. .Select(animator => ((RuntimeAnimatorController)animator.runtimeAnimatorController))
    I'm currently downloading 5.4 to test it myself and see if I have to make the change for the next version.

    From quickly looking at their documentation, the SkeletonAnimation component seems to have a timeScale property. With that in mind, it's easy to make it follow the Chronos timeline. Simply add a component script called "SpineChronosSync" that does:

    Code (CSharp):
    1. void Update()
    2. {
    3.     GetComponent<SkeletonAnimation>().timeScale = GetComponent<Timeline>().timeScale;
    4. }
     
    tnaseem likes this.