Skip to content

Instantly share code, notes, and snippets.

View cadenburleson's full-sized avatar
💭
Hacking it together.

Caden Burleson cadenburleson

💭
Hacking it together.
View GitHub Profile
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;
@ditzel
ditzel / KdTree.cs
Last active June 14, 2024 19:13
k-d Tree
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Profiling;
public class KdTree<T> : IEnumerable<T>, IEnumerable where T : Component
{
protected KdNode _root;
protected KdNode _last;
@alegueleres
alegueleres / ObjectPooler.cs
Last active September 18, 2018 07:37
Object Pooler used in Unity to instantiate objects in the level load of game, and use this instances, instead creating and destroying objects. The reason is to save CPU processment. Used the tutorial: https://www.raywenderlich.com/136091/object-pooling-unity. You can verify how to use this object pooler, it is a very cool approach.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ObjectPooler : MonoBehaviour {
public static ObjectPooler SharedInstance;
public List<ObjectPoolItem> itemsToPool;
public List<GameObject> pooledObjects;
///
/// Simple pooling for Unity.
/// Author: Martin "quill18" Glaude (quill18@quill18.com)
/// Latest Version: https://gist.github.com/quill18/5a7cfffae68892621267
/// License: CC0 (http://creativecommons.org/publicdomain/zero/1.0/)
/// UPDATES:
/// 2015-04-16: Changed Pool to use a Stack generic.
///
/// Usage:
///
@mstevenson
mstevenson / ConfigurableJointExtensions.cs
Created October 24, 2014 07:14
Extension methods for working with Configurable Joints for Unity
using UnityEngine;
public static class ConfigurableJointExtensions
{
/// <summary>
/// Sets a joint's targetRotation to match a given local rotation.
/// The joint transform's local rotation must be cached on Start and passed into this method.
/// </summary>
public static void SetTargetRotationLocal (this ConfigurableJoint joint, Quaternion targetLocalRotation, Quaternion startLocalRotation)
{