Skip to content

Instantly share code, notes, and snippets.

View BadLerp.cs
transform.position = Vector3.lerp(transform.position, target.position, Time.deltaTime)
// Or sometimes with an arbitrary multiplier to time, changing the lerp rate.
float lerpMod = ???; // Some formula
transform.position = Vector3.lerp(transform.position, target.position, Time.deltaTime * lerpMod)
View LerpCompletion.cs
while (lerpCompletion < 0.99)
lerpCompletion += Time.smoothDeltaTime * lerpMultiplier;
var curveValue = curve.Evaluate(lerpCompletion);
transform.localRotation = Quaternion.Slerp(_currentRotation, _desiredRotation, curveValue);
yield return null
View AnimCurveInit.cs
public AnimationCurve curve;
void Start()
curve = GetComponent<AnimationCurve>();
View PhoneRotation.cs
/// <summary>
/// This rotates the camera to match the orientation of the phone
/// </summary>
public void TiltPhone()
// Helps to stop us getting caught in a bad change of states. Resets in ResetRotation().
if (!tilting)
// Save our current rotation before doing anything else. This is where we'll return later.
#!/usr/bin/env python
from bs4 import BeautifulSoup
from import TwilioRestClient
import json
import os
import re
import requests
url = ''
View DebugDrawGameObjectMesh.cs
using UnityEngine;
public class DebugDrawGameObjectMesh : MonoBehaviour
public bool drawWireMesh = true;
public Color wireColor = new Color(0, 0, 0, .8f);
matt123miller /
Created Feb 8, 2017 — forked from mblondel/
Support Vector Machines
# Mathieu Blondel, September 2010
# License: BSD 3 clause
import numpy as np
from numpy import linalg
import cvxopt
import cvxopt.solvers
def linear_kernel(x1, x2):
return, x2)
View Extensions.cs
using UnityEngine;
using System.Collections.Generic;
public static class Extensions
// Collections
public static T RandomItem<T>(this T[] input) // do arrays and list share a type?
return input[Random.Range(0, input.Length - 1)];
View LookAt2D_Extension.cs
// Logic created by @DanInFiction on Twitter, I stole it to make an extension method.
using UnityEngine;
using System.Collections;
public static class LookAt2D_Extension {
public static void LookAt2D(this Transform self, Transform target){
self.right = target.position - self.position;
matt123miller / SmEntry.cs
Created Mar 31, 2016 — forked from mandarinx/SmEntry.cs
C# generics example
View SmEntry.cs
using UnityEngine;
public interface IOptionsItem {}
public class OptionsItem : IOptionsItem {
override public string ToString() {
return "OptionsItem";