Skip to content

Instantly share code, notes, and snippets.

View nukadelic's full-sized avatar
☣️

Nukadelic nukadelic

☣️
View GitHub Profile
@MattRix
MattRix / IsoSurface.cs
Last active October 12, 2021 02:48
Quick and dirty marching tetraheda isosurface thing
using UnityEngine;
using System.Collections;
using System;
using System.Collections.Generic;
[RequireComponent (typeof(MeshRenderer))]
[RequireComponent (typeof(MeshFilter))]
public class IsoSurface : MonoBehaviour
{
@MattRix
MattRix / MonoBehaviourInspector
Last active October 12, 2021 02:51
Allows you to use OnInspectorGUI in MonoBehaviour directly, rather than having to create a CustomEditor
using UnityEngine;
using UnityEditor;
using System.Collections;
using System.Collections.Generic;
using System.Reflection;
[CustomEditor (typeof(MonoBehaviour),true)]
[CanEditMultipleObjects]
public class MonoBehaviourInspector : Editor
{
@mattatz
mattatz / LIC.shader
Last active April 3, 2022 14:09
Simple Line Integral Convolution shader for Unity.
Shader "Mattaz/LIC" {
Properties {
_VectorFieldTex ("Vector Field Texture", 2D) = "white" {}
_NoiseTex ("Noise Texture", 2D) = "white" {}
_FlowLength ("Flow Length", int) = 10
}
SubShader {
Tags { "RenderType"="Opaque" }
LOD 200
@DuncanF
DuncanF / gist:353509dd397ea5f292fa52d1b9b5133d
Created January 29, 2020 10:43
Unity lockless (no GPU readback) marching cubes via Graphics.DrawProceduralIndirect - some slight faffing because compute shader must append full triangle (3 verts) at a time to render correctly, but this means the appendbuffer count is 3 times smaller than it needs to be, so we have to invoke a very short compute shader (FixupIndirectArgs) just…
MarchingCubesGPU.cs:
...
// DrawProceduralIndirect
ComputeBuffer argsBuffer;
[StructLayout(LayoutKind.Sequential)]
struct DrawCallArgBuffer
{
public const int size =
sizeof(int) +
sizeof(int) +
@v01pe
v01pe / Example.cs
Last active November 14, 2022 18:03
A relative simple way to get the instance object from a custom property drawer that draws a serialized class inside a component
using UnityEngine;
using System.Collections;
public class Example : MonoBehaviour
{
public ExampleClass example;
void Start() {}
void Update() {}
}
@antonkudin
antonkudin / pipeGenerator.cs
Created September 26, 2023 13:48
Generates pipe mesh from mesh segments
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class pipeGenerator : MonoBehaviour
{
[SerializeField] Mesh straightMesh;
[SerializeField] Mesh elbowMesh;
[Space]
[SerializeField] Vector3[] pathPoints;
@ssshake
ssshake / isWrit
Last active September 29, 2023 06:15
Photon PUN Cheat Sheet
## Photon Methods
**public class Blank : Photon.PunBehaviour**
instead of mono behavior, use this to receive photon callbacks in your script.
**public override void OnLeftRoom()**
An example of overriding a punbehavior callback
@MattRix
MattRix / PhysicsFollower.cs
Last active October 1, 2023 03:22
A thing you can use to make a rigidbody move towards a position reliably
using UnityEngine;
using System.Collections;
using System;
[RequireComponent (typeof(Rigidbody))]
public class PhysicsFollower : MonoBehaviour
{
public Transform target;
Rigidbody rb;
@jeffvella
jeffvella / RaycastUnderPointerSystem.cs
Created July 16, 2019 07:18
Unity Physics in ECS Raycasting
using BovineLabs.Entities.Systems;
using Unity.Burst;
using Unity.Entities;
using Unity.Jobs;
using Unity.Collections;
using Unity.Physics;
using Unity.Physics.Systems;
using UnityEngine;
[UpdateAfter(typeof(BuildPhysicsWorld)), UpdateBefore(typeof(EndFramePhysicsSystem))]
@neozero
neozero / main.cpp
Last active November 19, 2023 18:31
OculusHomeless - Use Oculus Dash without Home 2.0
/************************************************************************************
Content : First-person view test application for Oculus Rift
Created : 19th June 2015
Authors : Tom Heath
Copyright : Copyright 2015 Oculus, Inc. All Rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at