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
function Rotation(value) { | |
return Remap(value, -180, 180, Math.PI * -1, Math.PI); | |
} | |
function Remap(value, low1, high1, low2, high2) { | |
return low2 + (value - low1) * (high2 - low2) / (high1 - low1) | |
} |
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
function Vector3(x, y, z) { | |
this.x = x; | |
this.y = y; | |
this.z = z; | |
this.mul = function (multiplier) { | |
return new Vector3(this.x.mul(multiplier), this.y.mul(multiplier), this.z.mul(multiplier)); | |
}; | |
this.scale = function (anotherVector3) { | |
return new Vector3(this.x.mul(anotherVector3.x), this.y.mul(anotherVector3.y), this.z.mul(anotherVector3.z)); |
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
/* How to use | |
const Scene = require('Scene'); | |
const planeTracker = Scene.root.find('planeTracker'); | |
const model = Scene.root.find('model'); | |
const trs = new TouchTRS(planeTracker); | |
trs.AddModel(model); | |
*/ | |
function TouchTRS(planeTracker) { |
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
function RotationSignal(signal) { | |
return RemapSignal(signal, Reactive.val(-180), Reactive.val(180), Reactive.val(Math.PI * -1), Reactive.val(Math.PI)); | |
} | |
function RemapSignal(value, low1, high1, low2, high2) { | |
return low2.add(value.sub(low1).mul(high2.sub(low2)).div(high1.sub(low1))); | |
} |
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
// C# version source by keijiro: https://github.com/keijiro/Klak/blob/master/Assets/Klak/Motion/Runtime/BrownianMotion.cs | |
const Scene = require('Scene'); | |
BrownianMotion(Scene.root.find('bubble'), | |
{ | |
enablePositionNoise: true, | |
enableRotationNoise: false, | |
enableScaleNoise: false, | |
positionAmplitude: 10 | |
}); |
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
// Origin: http://guidohenkel.com/2013/04/a-simple-cross-fade-shader-for-unity/ | |
Shader "CrossFade" | |
{ | |
Properties | |
{ | |
_Blend("Blend", Range(0, 1)) = 0.5 | |
_Color("Main Color", Color) = (1, 1, 1, 1) | |
_MainTex("Texture 1", 2D) = "white" {} | |
_Texture2("Texture 2", 2D) = "" |
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 UnityEngine; | |
[Serializable] | |
public class RenderSource | |
{ | |
public Camera targetCamera; | |
public RenderTexture targetTexture; |
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
tell application "Finder" to set theFile to POSIX path of (selection as alias) | |
tell application "Finder" to set fileExtension to name extension of (selection as alias) |
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
function RandomNext(array) { | |
return array[Math.random() * array.length | 0]; | |
} |
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
tell application "Unity" to activate -- needs to be in front | |
tell application "System Events" to tell application process "Unity" | |
try | |
get properties of window 1 | |
set size of window 1 to {1280, 720} | |
on error errmess | |
log errmess | |
-- no window open | |
end try | |
end tell |
OlderNewer