Skip to content

Instantly share code, notes, and snippets.

@wh00ops
wh00ops / ForceProcessor.cs
Last active February 16, 2022 18:02
[Unity] An example of the code of how to calculate the force of a RigidBody in order to achieve the specified speed characteristics
using UnityEngine;
/// <summary>
/// An example of the code of how to calculate the force of a Rigidbody in order to achieve the specified speed characteristics.
/// </summary>
public class ForceProcessor : MonoBehaviour
{
/// <summary>
/// Target speed;
/// </summary>
@Lazersquid
Lazersquid / Inventory.cs
Last active March 14, 2021 10:21
ScriptableObject Reference Cache / Database
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Sirenix.OdinInspector;
using Sirenix.Serialization;
using UnityEngine;
public class Inventory : MonoBehaviour
{
@Ninja-Koala
Ninja-Koala / svg-to-shadertoy.py
Last active May 6, 2024 14:53
Convert a svg path to a shadertoy shader
#!/usr/bin/python3
import os
import sys
import numpy as np
def read_value(string, index):
#go to the beginning of the value
while svg_content[index] not in numerals:
index+=1
#read in the value
Shader "URP_PBR_7.12"
{
Properties
{
[MainColor] _BaseColor("Albedo Color", Color) = (0.5,0.5,0.5,1)
[MainTexture] _BaseMap("Albedo", 2D) = "white" {}
_BumpMap("Normal Map", 2D) = "bump" {}
_BumpScale("Scale", Range(1,2)) = 1.0
_Smoothness("Roughness", Range(0.0, 1.0)) = 0.5
[Gamma] _Metallic("Metallic", Range(0.0, 1.0)) = 0.0
@ercoppa
ercoppa / 80-keychron.rules
Last active February 25, 2023 18:30
K2 Keychron Ubuntu 18.04
SUBSYSTEMS=="input", ATTRS{name}=="Keychron K2", RUN+="/bin/sh -c 'echo 0 > /sys/module/hid_apple/parameters/fnmode'"
@defTechAndrew
defTechAndrew / fbx_animation_editing.py
Created April 1, 2019 22:01
Here are some useful calls I've developed for editing FBX animation files using the Python FBX SDK.
import FbxCommon
def fbx_trim_keys(scene, start, end, take_buffer=10):
"""
Uses the FBX SDK to remove unnecessary keys.
:param scene: FBX SDK scene class that hold data to edit
:param int start: start frame of animation keys to keep
:param int end: end frame of animation keys to keep
@tbttfox
tbttfox / mayaToNumpy.py
Last active July 12, 2024 02:02
Blazing fast maya api types to Numpy conversion
from maya import OpenMaya as om
import numpy as np
from ctypes import c_float, c_double, c_int, c_uint
_CONVERT_DICT = {
om.MPointArray: (float, 4, c_double, om.MScriptUtil.asDouble4Ptr),
om.MFloatPointArray: (float, 4, c_float , om.MScriptUtil.asFloat4Ptr),
om.MVectorArray: (float, 3, c_double, om.MScriptUtil.asDouble3Ptr),
om.MFloatVectorArray: (float, 3, c_float , om.MScriptUtil.asFloat3Ptr),
om.MDoubleArray: (float, 1, c_double, om.MScriptUtil.asDoublePtr),
@tamask
tamask / log.py
Created August 8, 2018 00:44
Route system output (stdout/stderr) of Blender to the app console (put in scripts/startup)
import os
import sys
import bpy
output = None
input = None
info = None
error = None
write = None
using System;
using System.Linq;
using System.Reflection;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
#if UNITY_EDITOR
using UnityEditor;
#endif
@rjmoggach
rjmoggach / nucamio.py
Last active January 9, 2021 17:07
nucamio
import math
import os
import re
import json
from pprint import pprint
from collections import OrderedDict
from operator import add
import maya.cmds as cmds
import maya.mel as mel