Skip to content

Instantly share code, notes, and snippets.

View INeatFreak's full-sized avatar
🏳️
Abandoning Projects

Neat Freak INeatFreak

🏳️
Abandoning Projects
View GitHub Profile
@FleshMobProductions
FleshMobProductions / SpringMotion.cs
Last active January 23, 2024 21:10
Ryan Juckett's Code for Damped Springs (https://www.ryanjuckett.com/damped-springs/) implemented in C# using UnityEngine Mathf methods
using UnityEngine;
namespace FMPUtils.Extensions
{
public static class SpringMotion
{
// Reference video:
// https://www.youtube.com/watch?v=bFOAipGJGA0
// Instant "Game Feel" Tutorial - Secrets of Springs Explained (by Toyful Games)
// The channel LlamAcademy also made an adaption of the concept for Unity,
@brihernandez
brihernandez / FreelancerShipPhysics.cs
Last active August 11, 2023 03:51
Freelancer ship physics for Unity. Includes engine kill and thruster.
// ====================================================================================================
// In my codebase, all ships have their own instance of this that they use to apply physics with.
// I'm using a struct mostly because I want to maintain copy semantics.
// ====================================================================================================
public struct FlightInput
{
public float Pitch;
public float Yaw;
public float Roll;
@Journeyman1337
Journeyman1337 / Chunk.cs
Last active August 3, 2022 03:34
This is a unity chunking system that supports 32km^2 of untextured terrain with lods. To avoid floating point errors, I also implemented a floating origin system which sets the origin as set intervals no to mess up worldspace coords in case they are used for UVs if this was ever textured. youtube video links in vids.txt
using System.Collections;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using UnityEngine;
[RequireComponent(typeof(MeshFilter))]
[RequireComponent(typeof(MeshRenderer))]
public class Chunk : MonoBehaviour
{
public MeshFilter meshFilter {get; private set;} = null;
@FlaShG
FlaShG / ConsoleAccessAttribute.cs
Created April 1, 2019 01:19
A simple, easy-to-use console for Unity.
using System;
[AttributeUsage(AttributeTargets.Method)]
public class ConsoleAccessAttribute : Attribute
{
}
@FlaShG
FlaShG / StateMachine.cs
Last active August 21, 2022 15:15
A simple state machine class for Unity. Use it to run regular methods or coroutines as states.
using UnityEngine;
using System;
using System.Collections;
/// <summary>
/// A simple state machine class. Use it to run regular methods or coroutines as states.
/// Steps to use:
/// 1. Define a private field for the StateMachine object.
/// private StateMachine stateMachine;
/// 2. Initialize the object in Awake. Pass the MonoBehaviour object to the constructor.
@LotteMakesStuff
LotteMakesStuff / Colors.cs
Created April 6, 2017 23:45
Trying to set Colours from code but need something better than the few that unity provide and dont wanna mess around with colour values for ages? Colors is your friend!!!
using UnityEngine;
public class Colors
{
// NOTE: The follwing color names come from the CSS3 specification, Section 4.3 Extended Color Keywords
// http://www.w3.org/TR/css3-color/#svg-color
public static readonly Color AliceBlue = new Color32(240,248,255,255);
public static readonly Color AntiqueWhite = new Color32(250,235,215,255);
public static readonly Color Aqua= new Color32(0,255,255,255);
@LotteMakesStuff
LotteMakesStuff / HighlightAttribute.cs
Last active May 3, 2024 01:38
Having trouble finding the right property on a component cos theres just so many identical looking fields? Add some color to you inspectors! mark important property with a bright color so it always stands out, or supply a validation function so highlights show on values that would effect the current ingame logic!
// NOTE DONT put in an editor folder
using UnityEngine;
public class HighlightAttribute : PropertyAttribute
{
public HighlightColor Color;
public string ValidateMethod;
public object Value;