This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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]; |