Skip to content

Instantly share code, notes, and snippets.

@MaxRoetzler
MaxRoetzler / MeshDestroy.cs
Created March 17, 2020 16:14 — forked from ditzel/MeshDestroy.cs
MeshDestroy => Put it on a game object with a mesh filter and renderer. Make sure to have read/write enabled on fbx import
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class MeshDestroy : MonoBehaviour
{
private bool edgeSet = false;
private Vector3 edgeVertex = Vector3.zero;
private Vector2 edgeUV = Vector2.zero;
@MaxRoetzler
MaxRoetzler / TGALoader.cs
Created February 19, 2020 17:31 — forked from mikezila/TGALoader.cs
TGA Loader for Unity3D
// This was made by aaro4130 on the Unity forums. Thanks boss!
// It's been optimized and slimmed down for the purpose of loading Quake 3 TGA textures from memory streams.
using System;
using System.IO;
using UnityEngine;
public static class TGALoader
{
@MaxRoetzler
MaxRoetzler / SmoothGameCameraMovement.cs
Created January 16, 2020 01:40 — forked from IRCSS/SmoothGameCameraMovement.cs
Unity Camera Movement in Game view like Scene View with filtering
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
// Moves Camera similar to how camera is moved in the Unity view port. Drop the scrip on the game object which has the camera and you wish to move.
public class SmoothGameCameraMovement : MonoBehaviour
{
@MaxRoetzler
MaxRoetzler / RayBoxIntersectFast.cs
Created February 18, 2019 14:15 — forked from unitycoder/RayBoxIntersectFast.cs
RayBoxIntersect Faster than bounds.IntersectRay
// this is faster than unity *.bounds.IntersectRay(ray)
// original source https://gamedev.stackexchange.com/a/103714/73429
float RayBoxIntersect(Vector3 rpos, Vector3 rdir, Vector3 vmin, Vector3 vmax)
{
float t1 = (vmin.x - rpos.x) / rdir.x;
float t2 = (vmax.x - rpos.x) / rdir.x;
float t3 = (vmin.y - rpos.y) / rdir.y;
float t4 = (vmax.y - rpos.y) / rdir.y;
float t5 = (vmin.z - rpos.z) / rdir.z;
@MaxRoetzler
MaxRoetzler / TriggerContainerEditor.cs
Created September 10, 2018 14:24 — forked from bzgeb/TriggerContainerEditor.cs
Example Drag & Drop area in a custom inspector for the Unity editor
using UnityEngine;
using System.Collections;
using UnityEditor;
[CustomEditor (typeof(TriggerContainer))]
public class TriggerContainerEditor : Editor
{
private SerializedObject obj;