Skip to content

Instantly share code, notes, and snippets.

View ctankep's full-sized avatar

Chuan Lim ctankep

View GitHub Profile
@FleshMobProductions
FleshMobProductions / PiecewiseLerp.cs
Created February 24, 2021 07:52
PiecewiseLerp for cheaply interpolating between cached results of more complex interpolation functions, based on https://www.alanzucconi.com/2021/01/24/piecewise-interpolation/
// An additional implementation for piecewise interpolation described in this article:
// https://www.alanzucconi.com/2021/01/24/linear-interpolation/
// It has the limitation that it requires the delta difference between 2 adjacent values of the input array to always be constant.
// For example: inputs[2] - inputs[1] = 0.2f; inputs inputs[3] - inputs[2] = 0.2f; etc.
public static float PiecewiseLerp (float[] inputs, float[] results, float desiredInput)
{
int n = inputs.Length;
float inputMin = inputs[0];
float inputMax = inputs[n - 1];
@ManeFunction
ManeFunction / EasingFunctions.cs
Last active May 3, 2024 13:32 — forked from cjddmut/EasingFunctions.cs
Easing Functions for Unity3D
/*
* Created by C.J. Kimberlin
* Refactored by Mane Function
*
* The MIT License (MIT)
*
* Copyright (c) 2019-2023
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@kkostenkov
kkostenkov / VrPosSync.cs
Created August 11, 2016 11:38
Script that uses HTC Vive cam position to set position of Perception Neuron in Unity.
using UnityEngine;
public class VrPosSync : MonoBehaviour {
public Transform viveCamEye;
public Transform neuronHead;
public Transform neuronPelvis;
void LateUpdate () {
Vector3 headPelvisOffset = neuronHead.position - neuronPelvis.position;
neuronPelvis.position = viveCamEye.position - headPelvisOffset;
@rygorous
rygorous / vr_urgh.txt
Last active September 6, 2022 21:35
What I mean when I say "I think VR is bad news".
This just got linked to by the Y combinator news account, without proper context,
so a brief introduction: A month ago (end of May / early June 2014) I had a
Twitter conversation with a bunch of acquaintances. One tweet in the middle
of that thread, with obligatory hyperbole, was me saying that I think VR is
bad news.
Well, that part of the thread (but not the rest that provides context) recently
got retweeted, and then someone asked me if I could explain what I mean by that,
and because Twitter is a great platform for delivering 140 character slogans and
not so great for lengthy explanations, I wrote this. So, obligatory disclaimer: