Concisely animating a local T value along a path

If you have a T value, in the range of [0.0-1.0] you can convert that to a local T value for each part of that curve.

    var rangePerItem = 1.0 / items.length;
    var t = 0.73;
 
    for(var i = 0; i < items.length; i++) {
        // determine which piece of the line this item falls into
        var a          = i * rangePerItem;
        var b          = (i + 1) * rangePerItem;
 
        // normalize the value so that 0.51 on the third one becomes 1.0 for the first and second, and 0.2 for the third, and 0 for the 4th
        var localT     = (t - a) / (b - a);
        localT = clamp(localT, 0, 1);
        item.update(localT);
    }

VSCode in Unity

If you’re tired of MonoDevelop’s editing capabilities, you should try VSCode!
It’s super snappy, and lightweight

Screen Shot 2016-08-24 at 1.36.38 PM

  1. Download VSCode insiders edition
  2. Install the C# 1.3.0 support
  3. Install mono debugger
  4. brew install mono (need this for intellisense to work)
  5. In unity, open C# project by going to Assets > Open C# Project In Code (don’t just double click a file)