Skip to content

Instantly share code, notes, and snippets.

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)
while (lerpCompletion < 0.99)
{
lerpCompletion += Time.smoothDeltaTime * lerpMultiplier;
var curveValue = curve.Evaluate(lerpCompletion);
transform.localRotation = Quaternion.Slerp(_currentRotation, _desiredRotation, curveValue);
yield return null
}
public AnimationCurve curve;
void Start()
{
curve = GetComponent<AnimationCurve>();
}
/// <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 twilio.rest import TwilioRestClient
import json
import os
import re
import requests
url = 'https://postmates.com/los-angeles'
using UnityEngine;
public class DebugDrawGameObjectMesh : MonoBehaviour
{
[Header("Configuration")]
[Space]
public bool drawWireMesh = true;
public Color wireColor = new Color(0, 0, 0, .8f);
@matt123miller
matt123miller / svm.py
Created February 8, 2017 00:16 — forked from mblondel/svm.py
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 np.dot(x1, x2)
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)];
}
// 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
matt123miller / SmEntry.cs
Created March 31, 2016 09:30 — forked from mandarinx/SmEntry.cs
C# generics example
using UnityEngine;
public interface IOptionsItem {}
public class OptionsItem : IOptionsItem {
override public string ToString() {
return "OptionsItem";
}
}