Skip to content

Instantly share code, notes, and snippets.

jmschrack / smoothDampFilter.js
Created February 7, 2024 15:33
SmoothDamp filter for js
* Critically Damped Ease-In/Ease-Out Smoothing
* reference: "Game Programming Gems 4" Chapter 1.10 (ISBN-13: 978-1584502951)
* (page 96)
* Originally named "SmoothCD", but Unity calls this "SmoothDamp" so we'll stick with that for easier time with google
* If you want the filter to keep track of the delta time, use the "filter" function. If you just want to pass in the delta time, use "update"
* I've modified this to run on an array (i.e. matrices), it makes 2 assumptions:
* 1) Every value uses the same smoothTime and maxSpeed
* 2) Every value can be modified independently of each other
jmschrack / ThreeJSEditor_AddExternalLibrary.js
Created November 9, 2022 22:24
Two helper scripts that will let you add external libraries or modules to the tool.
## Add External JS libraries ##
This function will inject a new `<script />` tag into the header of the page.
You can specify the id, url, and onload events. If it detects the ID already exists, it aborts which makes it safe to use in the Editor.
function SafeAddScriptSrc(id,url,onload){
console.log('SafeAddScriptSrc::'+id+' Adding...');
jmschrack /
Last active March 30, 2022 19:42
Researching into resurrecting Oculus Go devices for events


  1. Figure out how to "lock" the headset into a demo mode for 360 content
  2. See what else we can do

Useful Links

Unlock the Bootloader

  • I had to factory reset the device in order to login with my account, so I could enable developer mode.
  • Then I could use ADB
  • I had to apply the unlock twice for some reason. It took the second time.
jmschrack / scene-environment.js
Last active March 23, 2022 04:49
AFRAME component: Sets an environment map for the scene.
/* ==========================================
* Equirect Environment Map example:
* <a-scene environment="path: env.png;">
* "path" - url to an image
* ==========================================
* Cubemap Environment Map example:
* <a-scene environment="path: images/cubemap/; isEquirect:false;" >
jmschrack / CreateScriptableWizard.cs
Created February 24, 2021 17:08
Unity Editor: Adds context menu item to create a template Scriptable Wizard
using UnityEngine;
using UnityEditor;
using System;
using System.IO;
using System.Text;
public class CreateScriptableWizard{
[MenuItem("Assets/Create/C# Scriptable Wizard",false,105)]
static void Create(){
jmschrack / AnimatorController.cs
Last active July 14, 2020 01:13
A thin helper wrapper for manually calling animations on an Animator.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
/// <summary>
/// A thin wrapper for easily Playing specific animations. And checking if the animation is currently playing
/// </summary>
public class AnimatorController : MonoBehaviour
Animator _animator;
public Animator animator=>_animator;
jmschrack / torch-1.6.0a0+d5461e7-cp36-cp36m-linux_x86_64.whl.txt
Created May 19, 2020 22:49
PyTorch for ROCm 3.3. Compiled for gfx900 (Vega10 series) with HCC
jmschrack / IAsyncOperationExtensions.cs
Created December 18, 2019 20:19
Extensions that turns Unity's AsyncOperations into true C# async/await. Full credit to james7132 on the unity forum
Full credit to james7132
public static class IAsyncOperationExtensions {
public static AsyncOperationAwaiter GetAwaiter(this IAsyncOperation operation) {
return new AsyncOperationAwaiter(operation);
jmschrack / ActionLookupTable.cs
Last active February 18, 2021 16:15
A simple, thread-safe lookup table for Actions that generate guaranteed unique keys.
using System;
using System.Collections;
using System.Collections.Generic;
using System.Threading;
///<summary> A simple lookup table that generates guaranteed unique keys. Thread Safe. </summary>
public class ActionLookupTable<E>{
private long lastTimeStamp=-1;
Dictionary<long,Action<E>> table = new Dictionary<long, Action<E>>();
jmschrack / ToggleSlider.cs
Created September 3, 2019 22:15
A "slider style" toggle UI component for Unity. Appears under Right Click>GameObject/UI/ToggleSlider
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.Events;
using UnityEngine.EventSystems;
using UnityEditor;
public class ToggleSliderEditor : Editor{