Skip to content

Instantly share code, notes, and snippets.

🍪

D. E. ditzel

🍪
Block or report user

Report or block ditzel

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@ditzel
ditzel / MeshDestroy.cs
Created Aug 19, 2019
MeshDestroy => Put it on a game object with a mesh filter and renderer. Make sure to have read/write enabled on fbx import
View MeshDestroy.cs
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class MeshDestroy : MonoBehaviour
{
private bool edgeSet = false;
private Vector3 edgeVertex = Vector3.zero;
private Vector2 edgeUV = Vector2.zero;
@ditzel
ditzel / ScrollAndPinch.cs
Created Jul 22, 2019
Pinch and Scroll to Move and Zoom in Unity for Mobile Games
View ScrollAndPinch.cs
/*
Set this on an empty game object positioned at (0,0,0) and attach your active camera.
The script only runs on mobile devices or the remote app.
*/
using UnityEngine;
class ScrollAndPinch : MonoBehaviour
@ditzel
ditzel / Math3D.cs
Last active Apr 18, 2019
Unity Math
View Math3D.cs
static class Math3D
{
private static System.Random rand = new System.Random();
public static float DistanceToLine(Ray ray, Vector3 point)
{
//see:http://answers.unity3d.com/questions/62644/distance-between-a-ray-and-a-point.html
return Vector3.Cross(ray.direction, point - ray.origin).magnitude;
}
@ditzel
ditzel / PhysicsHelper.cs
Created Jan 20, 2019
Unity Helper for Physic Functions
View PhysicsHelper.cs
using UnityEngine;
namespace Ditzelgames
{
public static class PhysicsHelper
{
public static void ApplyForceToReachVelocity(Rigidbody rigidbody, Vector3 velocity, float force = 1, ForceMode mode = ForceMode.Force)
{
if (force == 0 || velocity.magnitude == 0)
@ditzel
ditzel / CameraEffects.cs
Last active Oct 13, 2019
Camera Shake Effect. Just put in on the camera and call Shake()
View CameraEffects.cs
using UnityEngine;
namespace DitzeGames.Effects
{
/// <summary>
/// Camera Effects
/// </summary>
public class CameraEffects : MonoBehaviour
{
View DistanceJoint3D.cs
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;
View TouchToShoot.cs
using UnityEngine;
public class TouchToShoot : MonoBehaviour {
public Material hitMaterial;
// Use this for initialization
void Start () {
}
View KdTree.cs
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;
View HappyCube.cs
using UnityEngine;
public class HappyCube : MonoBehaviour {
MeshFilter mFilter;
Mesh Mesh;
public float UpDownFactor = 0.1f;
public float UpDownSpeed = 6f;
public float LeftFactor = 0.3f;
View Paintable.cs
using System.Collections;
using System.IO;
using UnityEngine;
public class Paintable : MonoBehaviour {
public GameObject Brush;
public float BrushSize = 0.1f;
public RenderTexture RTexture;
You can’t perform that action at this time.