Skip to content

Instantly share code, notes, and snippets.

View di404's full-sized avatar
๐Ÿ˜ฅ
่’Ÿ่’ป้—ฎ็ญ”

di404

๐Ÿ˜ฅ
่’Ÿ่’ป้—ฎ็ญ”
View GitHub Profile
@di404
di404 / EnumBuilder.cs
Last active February 12, 2025 08:34
Unity EnumBuilder, build List to enum for reference
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using UnityEditor;
using UnityEngine;
namespace STMMfyd
{
public static class EnumBuilder
@di404
di404 / DrawArrow.cs
Created February 12, 2025 03:45
Unity Draw Debug Arrow
using UnityEngine;
using System.Collections;
public static class DrawArrow
{
public static void ForGizmo(Vector3 pos, Vector3 direction, float arrowHeadLength = 0.25f, float arrowHeadAngle = 20.0f)
{
Gizmos.DrawRay(pos, direction);
Vector3 right = Quaternion.LookRotation(direction) * Quaternion.Euler(0,180+arrowHeadAngle,0) * new Vector3(0,0,1);
@di404
di404 / TransformEditorExtension
Created February 11, 2025 10:47
Transorm Reset Button Extension
using UnityEditor;
using UnityEngine;
[CustomEditor(typeof(Transform))]
public class TransformEditorExtension : Editor
{
private const float ButtonWidth = 24f;
private GUIContent resetIcon;
private GUIContent lockIconOn;
@di404
di404 / CheckLFSFileSizes.ps1
Last active February 9, 2025 18:58
List files managed by Git LFS in the current repository and order by size
git lfs ls-files -n > lfs_files_list.txt
$lfsFiles = Get-Content lfs_files_list.txt | ForEach-Object {
$_.Trim()
}
$fileSizes = @()
foreach ($file in $lfsFiles) {
if (Test-Path $file) {
$sizeMB = (Get-Item $file).Length / 1MB
@di404
di404 / Player.gd
Created August 2, 2024 07:38 — forked from bramreth/Player.gd
How to make a 3D Platfomer in Godot 4: Setup, Movement, and Camera Controls - code dump
extends RigidBody3D
var mouse_sensitivity := 0.001
var twist_input := 0.0
var pitch_input := 0.0
@onready var twist_pivot := $TwistPivot
@onready var pitch_pivot := $TwistPivot/PitchPivot
func _ready() -> void:
// c# companion script
// SpriteUVToShader.cs -------------------------------------------------------------------------------------------------------------------------------- //
// Save you your project, add to your SpriteRenderer gameObject
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
[ExecuteInEditMode]
@di404
di404 / cors_server.py
Last active July 2, 2019 10:35 — forked from enjalot/cors_server.py
Allow CORS with python simple http server.Now it work on Python3.
from http.server import SimpleHTTPRequestHandler
from http.server import socketserver
class CORSHTTPRequestHandler(SimpleHTTPRequestHandler):
def send_head(self):
"""Common code for GET and HEAD commands.
This sends the response code and MIME headers.
Return value is either a file object (which has to be copied
to the outputfile by the caller unless the command was HEAD,
@di404
di404 / DistanceJoint3D.cs
Created February 2, 2019 15:53 — forked from ditzel/DistanceJoint3D.cs
Rope Physics
using UnityEngine;
public class DistanceJoint3D : MonoBehaviour {
public Transform ConnectedRigidbody;
public bool DetermineDistanceOnStart = true;
public float Distance;
public float Spring = 0.1f;
public float Damper = 5f;