Skip to content

Instantly share code, notes, and snippets.

Avatar
💻
Software engineer, game / graphics programmer

Tahar Meijs tntmeijs

💻
Software engineer, game / graphics programmer
View GitHub Profile
@tntmeijs
tntmeijs / layer2d.cs
Created Feb 13, 2018
A simple tool for the Unity2D editor which allows you to hide sorting layers.
View layer2d.cs
using UnityEditor;
using UnityEngine;
/*
* This creative work (which includes code) is under exclusive copyright by default.
* Unless specified otherwise by Tahar Meijs, nobody else may use, copy, distribute,
* or modify this work without being at risk of take-downs, shake-downs, or litigation.
*
* Testing code does not mean you will are allowed to keep on using this codebase for
* your own personal / commercial gain. However, it is always encouraged to use this
@tntmeijs
tntmeijs / editorscreenshot.cs
Created Feb 13, 2018
An Unity editor extension which enables you to take screenshots of the scene view window.
View editorscreenshot.cs
using System.IO;
using UnityEditor;
using UnityEngine;
/*
* This creative work (which includes code) is under exclusive copyright by default.
* Unless specified otherwise by Tahar Meijs, nobody else may use, copy, distribute,
* or modify this work without being at risk of take-downs, shake-downs, or litigation.
*
* Testing code does not mean you will are allowed to keep on using this codebase for
@tntmeijs
tntmeijs / BezierCurve.cs
Last active Nov 16, 2019
Bezier curves in Unity3D using Casteljau's algorithm
View BezierCurve.cs
using System.Collections.Generic;
using UnityEngine;
public class BezierCurve : MonoBehaviour
{
// Casteljau's algorithm based on the implementation in: "3D Math Primer for Graphics and Game Development"
public static Vector3 Curve(List<Vector3> points, float t)
{
Vector3[] allPoints = points.ToArray();
int n = allPoints.Length;
@tntmeijs
tntmeijs / unitythreedimensionalperlinnoise.cs
Last active Jul 10, 2020
A 3D implementation using the 2D Perlin noise function of Unity3D.
View unitythreedimensionalperlinnoise.cs
public static float Noise3D(float x, float y, float z, float frequency, float amplitude, float persistence, int octave, int seed)
{
float noise = 0.0f;
for (int i = 0; i < octave; ++i)
{
// Get all permutations of noise for each individual axis
float noiseXY = Mathf.PerlinNoise(x * frequency + seed, y * frequency + seed) * amplitude;
float noiseXZ = Mathf.PerlinNoise(x * frequency + seed, z * frequency + seed) * amplitude;
float noiseYZ = Mathf.PerlinNoise(y * frequency + seed, z * frequency + seed) * amplitude;
You can’t perform that action at this time.