Skip to content

Instantly share code, notes, and snippets.

@v21
v21 / gist:5378391
Created April 13, 2013 13:23
A script to get a random point on a mesh, for Unity3D
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class RandomPointOnMesh : MonoBehaviour
{
public MeshCollider lookupCollider;
public bool bangGetPoint;
private Vector3 randomPoint;
@mkropat
mkropat / knownpaths.py
Last active July 1, 2024 19:21
Python wrapper around the SHGetKnownFolderPath Windows Shell function
import ctypes, sys
from ctypes import windll, wintypes
from uuid import UUID
class GUID(ctypes.Structure): # [1]
_fields_ = [
("Data1", wintypes.DWORD),
("Data2", wintypes.WORD),
("Data3", wintypes.WORD),
("Data4", wintypes.BYTE * 8)
@keiranlovett
keiranlovett / Base_Texture
Created February 6, 2014 03:38
Unreal Engine 4's Physically Based Shader Model
Shader "Base_Texture"
{
Properties
{
_DiffuseAmount ( "Diffuse Amount", Range( 0.0, 1.0 ) ) = 0.25
_TexAmount ( "Texture Amount", Range( 0.0, 1.0 ) ) = 0.25
_SpecAmount ( "Specular Amount", Range( 0.0, 16.0 ) ) = 1.0
_SpecTexAmount ( "Spec Texture Amount", Range( 0.0, 1.0 ) ) = 0.25
_Diffusemap ( "Diffusemap", 2D ) = "diffuse" {}
@digitaljhelms
digitaljhelms / post-rewrite
Created September 22, 2014 14:49
Git hook to call `git submodule update` automatically.
#!/bin/sh
echo "[post-rewrite hook: $1]"
# quick script to call "git submodule update" automatically if the
# .gitmodules file is changed
changedfiles=( `git diff-tree --no-commit-id --name-only HEAD@{1} HEAD` )
if [[ "${changedfiles[*]}" =~ ".gitmodules" ]]; then
echo "initializing & updating submodule(s)"
@McFunkypants
McFunkypants / FlyCamera.cs
Created November 7, 2014 21:59
New Script FlyCamera add to any camera obj: instant unity editor style wasd rightclick debug cam
using UnityEngine;
using System.Collections;
public class FlyCamera : MonoBehaviour {
/*
Writen by Windexglow 11-13-10. Use it, edit it, steal it I don't care.
Converted to C# 27-02-13 - no credit wanted.
Simple flycam I made, since I couldn't find any others made public.
Made simple to use (drag and drop, done) for regular keyboard layout
@JokerMartini
JokerMartini / Desktop Notification | .ms
Last active June 3, 2021 00:11
Maxscript: Send a simple desktop notification similar to skype, from 3ds Max to the desktop. When users click on the balloon notification, in this example, it will open a windows explorer.
fn closeIcon s e = s.dispose()
fn balloonClicked s e = shelllaunch @"c:\windows\" ""
a = dotnetobject "notifyicon"
a.visible = true
a.icon = (dotnetclass "system.drawing.systemIcons").information
dotnet.addEventHandler a "BalloonTipClosed" closeIcon
dotnet.addEventHandler a "BalloonTipClicked" balloonClicked
a.showballoontip 1000 "test" "test2" (dotnetclass "tooltipicon").info
@cruftlord
cruftlord / Subfolder to git repo.md
Last active April 26, 2024 03:37 — forked from korya/Subfolder to git repo.md
Convert subfolder into Git submodule
import maya.OpenMaya as om
import maya.cmds as mc
import uuid
def get_name(node):
"""Get the long name from the MObject where appropriate"""
if node.hasFn(om.MFn.kDagNode):
return om.MFnDagNode(node).fullPathName()
else:
return om.MFnDependencyNode(node).name()
@ivogrig
ivogrig / pointInCamera.py
Last active June 18, 2016 01:47
Test is a given point is visible in the camera and Convert between 3d and screen coordinates
# Test is a given point is visible in the camera
# Convert between 3d and screen coordinates
import modo
# Assuming the camera is also the active view
def pointInCamera(cam, position):
aperture_x = cam.channel(lx.symbol.sICHAN_CAMERA_APERTUREX).get()
aperture_y = cam.channel(lx.symbol.sICHAN_CAMERA_APERTUREY).get()
using UnityEngine;
using UnityEditor;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Reflection;
[InitializeOnLoad]
public class EditorCameraSpeed
: EditorWindow