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; | |
[ExecuteInEditMode] | |
public class AbsoluteScale : MonoBehaviour { | |
public Vector3 scale = new Vector3(1f, 1f, 1f); | |
#if UNITY_EDITOR | |
void Update () { | |
if (Application.isPlaying) |
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; | |
/* | |
Dual-Quaternions are an alternate encoding for rigid transforms (translation + rotation), | |
with the special property that linear combinations will "arc" the translation in response | |
to rotation, producing a skinning interpolation that prevents the kind of collapsing you | |
get from simple linear interpolation of translations in their native coordinates. | |
Copyright (c) 2018 Max Kaufmann |
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
#include <cstdio> | |
#include <cstdint> | |
#include <cstdlib> | |
#include "glm/glm.hpp" | |
#include "glm/gtx/type_aligned.hpp" | |
namespace Trinket { | |
enum class OP : uint8_t { | |
NOOP, |
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
/* | |
Copyright (c) 2018 Max Kaufmann | |
Permission is hereby granted, free of charge, to any person obtaining a copy | |
of this software and associated documentation files (the "Software"), to deal | |
in the Software without restriction, including without limitation the rights | |
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
copies of the Software, and to permit persons to whom the Software is | |
furnished to do so, subject to the following conditions: |
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
PImage img; | |
img = loadImage("https://espnfivethirtyeight.files.wordpress.com/2017/03/wasserman-landslides1.png", "png"); | |
img.loadPixels(); | |
int w = img.width; | |
int h = img.height; | |
int len = w * h; | |
for(int i=0; i<len; ++i) { | |
color c = img.pixels[i]; | |
float r = red(c); | |
float b = blue(c); |
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 InControl; | |
using System.Collections; | |
using UnityEngine; | |
[RequireComponent(typeof(CharacterController))] | |
public class RobotPants : MonoBehaviour { | |
public Transform hips; | |
public TwoBoneIK legLeft; | |
public TwoBoneIK legRight; |
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; | |
/* | |
Copyright 2016 Max Kaufmann ([email protected]) | |
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | |
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | |
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
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
checkStateChange = (token) -> switch(token) | |
when 'm' then state_moveTo | |
when 'c' then state_curveTo0 | |
when 'l' then state_lineTo | |
when 'z' then null | |
else null | |
checkPoint = (token) -> | |
numbers = token.split ',' |
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 System; | |
using System.Collections; | |
using System.Collections.Generic; | |
using System.IO; | |
using System.Linq; | |
using System.Text; | |
using UnityEditor; | |
using UnityEngine; | |
public static class Misc { |
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
// Runs on C runtime, exports C-ABI. | |
// No Headers | |
import cstdlib; | |
import cstdio; | |
struct vec2 { | |
float x, y; | |
// struct methods |
NewerOlder