Skip to content

Instantly share code, notes, and snippets.

/**
* \brief Returns positional offset for a given point as a result of summing 4 gerstner waves
* \param positionWS point in world space
* \param wavelengths wavelength of each of the 4 waves
* \param amplitudes amplitudes of each of the 4 waves
* \param directions direction of each of the 4 waves (each row = one direction). MUST BE NORMALIZED!
* \param speed global speed multiplier. Individual wave speed depends on Wavelength
* \param steepness Gerstner wave 'Steepness' parameter. Modulates the horizontal offset of points
* \param normal returns the normal of given point.
* \return positional offset of the given point
@noio
noio / OptionLanguage.cs
Created March 9, 2023 12:32
Implementation of a Player Option for Language setting
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using UnityEngine.Assertions;
using UnityEngine.Localization;
using UnityEngine.Localization.Pseudo;
using UnityEngine.Localization.Settings;
#if UNITY_EDITOR
using System;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.Localization.SmartFormat.Core.Extensions;
using UnityEngine.Localization.SmartFormat.PersistentVariables;
namespace InputHints
{
internal struct InputActionVariable : IVariableValueChanged
{
{
"Version": 3,
"Vars": {
"Player": {
"RunSpeed": 3.0,
"WalkSpeed": 1.5,
"CrippledSpeed": 0.5,
"FallHardHeight": 4.0,
"HorizontalClimbSpeed": 1.0,
"VerticalClimbSpeed": 1.0,
@noio
noio / detect-hands.py
Created August 22, 2017 07:29
detecting hands
import os
import sys
import warnings
import random
import numpy as np
import pandas as pd
from keras import backend as K
from keras.models import Sequential
using UnityEngine;
using UnityEngine.Assertions;
using UnityEditor;
using System.Linq;
using System.IO;
using System.Reflection;
using System.Collections;
using System.Collections.Generic;
public class Somefile
/* By Thomas "noio" van den Berg
Add this script to the UI.Buttons that form
a left/right arrow pair. For each button,
drag the *other* button into the "other" field.
It requires that your buttons are animated using
"Transition: Animation", (not Sprite Swap) with an
animator that has the default Trigger parameters defined
("Normal", "Highlighted", "Pressed")
@noio
noio / gist:66a914ae152eda3a170b
Created June 22, 2015 08:25
Replace Sprites in Animation
public static Sprite GetSpriteWithWordReplaced(Sprite sprite, string word, string replaceBy)
{
string assetPath = AssetDatabase.GetAssetPath(sprite);
string spriteName = sprite.name;
string newName = spriteName.Replace(word, replaceBy);
string newPath = assetPath.Replace(word, replaceBy);
foreach (Object assetObject in AssetDatabase.LoadAllAssetsAtPath(newPath))
{
Sprite newSprite = assetObject as Sprite;
IEnumerator Shoot() {
while (true)
{
Debug.Log("Shoot!");
yield return new WaitForSeconds(1.0f);
}
}
void WalkAwayMan() {
Debug.Log("Walking Away");
@noio
noio / gist:8c76cf72a74bcd343ff8
Created March 6, 2015 20:00
Create Fragments from Sprite
#!/usr/bin/env python
import sys, os
import numpy as np
from matplotlib import cm
from scipy import ndimage, misc, spatial
OKGREEN = '\033[92m'
WARNING = '\033[93m'
ENDC = '\033[0m'