Skip to content

Instantly share code, notes, and snippets.

View RichardHoffmannX's full-sized avatar
💭
VisionOS (Spation Computing) and other cool XR Stuff...

Richard Hoffmann RichardHoffmannX

💭
VisionOS (Spation Computing) and other cool XR Stuff...
View GitHub Profile
@RichardHoffmannX
RichardHoffmannX / FlyCamera.cs
Created January 15, 2026 01:09 — forked from FreyaHolmer/FlyCamera.cs
A camera controller for easily flying around a scene in Unity smoothly. WASD for lateral movement, Space & Ctrl for vertical movement, Shift to move faster. Add this script to an existing camera, or an empty game object, hit play, and you're ready to go~
using UnityEngine;
[RequireComponent( typeof(Camera) )]
public class FlyCamera : MonoBehaviour {
public float acceleration = 50; // how fast you accelerate
public float accSprintMultiplier = 4; // how much faster you go when "sprinting"
public float lookSensitivity = 1; // mouse look sensitivity
public float dampingCoefficient = 5; // how quickly you break to a halt after you stop your input
public bool focusOnEnable = true; // whether or not to focus and lock cursor immediately on enable
@RichardHoffmannX
RichardHoffmannX / gist:aa21b9d94734dd5dc30b5992675a97ee
Created December 27, 2025 12:49 — forked from darkfall/gist:1656050
A simple class that converts a image to a icon in c# without losing image color data, unlike System.Drawing.Icon; ico with png data requires Windows Vista or above
class PngIconConverter
{
/* input image with width = height is suggested to get the best result */
/* png support in icon was introduced in Windows Vista */
public static bool Convert(System.IO.Stream input_stream, System.IO.Stream output_stream, int size, bool keep_aspect_ratio = false)
{
System.Drawing.Bitmap input_bit = (System.Drawing.Bitmap)System.Drawing.Bitmap.FromStream(input_stream);
if (input_bit != null)
{
int width, height;