Skip to content

Instantly share code, notes, and snippets.

View Milk-Drinker01's full-sized avatar

Cameron Dus Milk-Drinker01

View GitHub Profile
@Milk-Drinker01
Milk-Drinker01 / BoxBoundsExample.cs
Created September 24, 2022 15:46
Unity Editor Bounds Handle
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
#if UNITY_EDITOR
using UnityEditor;
using UnityEditor.IMGUI.Controls;
#endif
public class BoxBoundsExample : MonoBehaviour
{
@Milk-Drinker01
Milk-Drinker01 / MultiplyMatrix4x4.cs
Created May 4, 2022 21:48
Multiply Matrix 4x4 with last row being equivalent to the identity matrix
// Multiplies two matrices when the last rows are equivilent to 0 0 0 1.
Matrix4x4 multiplyMatrix4x3(Matrix4x4 lhs, Matrix4x4 rhs)
{
Matrix4x4 res;
res.m00 = lhs.m00 * rhs.m00 + lhs.m01 * rhs.m10 + lhs.m02 * rhs.m20;
res.m01 = lhs.m00 * rhs.m01 + lhs.m01 * rhs.m11 + lhs.m02 * rhs.m21;
res.m02 = lhs.m00 * rhs.m02 + lhs.m01 * rhs.m12 + lhs.m02 * rhs.m22;
res.m03 = lhs.m00 * rhs.m03 + lhs.m01 * rhs.m13 + lhs.m02 * rhs.m23 + lhs.m03;
res.m10 = lhs.m10 * rhs.m00 + lhs.m11 * rhs.m10 + lhs.m12 * rhs.m20;