Skip to content

Instantly share code, notes, and snippets.

@pofulu
pofulu / ShinobiWPS-Unity_WebGL_tips.md
Last active June 8, 2021 03:02 — forked from ShinobiWPS/ShinobiWPS-Unity_WebGL_tips.txt
ShinobiWPS - Tips to optimize a WebGL build of a Unity game
@pofulu
pofulu / smoothDamp.swift
Created January 25, 2021 10:41 — forked from devindazzle/smoothDamp.swift
The smoothDamp function in Unity implemented using Swift
/**
* Gradually changes a value towards a desired goal over time - implemented from Unity C#
*/
public func smoothDamp(current c: CGFloat, target t: CGFloat, currentVelocity: inout CGFloat, smoothTime time: CGFloat, maxSpeed: CGFloat = CGFloat.infinity, deltaTime: CGFloat) -> CGFloat {
let smoothTime = max(0.0001, time)
let num = 2 / smoothTime
let num2 = num * deltaTime
let num3 = 1 / (1 + num2 + 0.48 * num2 * num2 + 0.235 * num2 * num2 * num2)
var num4 = c - t
let num5 = t
@pofulu
pofulu / Open Unity 16-9.scpt
Created April 30, 2019 03:07 — forked from walterpalladino/Open Unity 16-9.scpt
How to Open the Unity Window on Mac OS X on a 16:9 relationship (1280x720)
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
@pofulu
pofulu / filename.applescript
Created April 9, 2019 15:00 — forked from lg0/filename.applescript
applescript:get selected filename and extension
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)