Skip to content

Instantly share code, notes, and snippets.

View unitycoder's full-sized avatar
✅
‏‏‎

mika unitycoder

✅
‏‏‎
View GitHub Profile
@unitycoder
unitycoder / DelaunyTriangulation.cs
Created November 14, 2022 15:04
Delauny triangulations with Bowyer-Watson algorithm
// https://forum.unity.com/threads/delauny-triangulations-with-bowyer-watson-algorithm-produces-inconsistent-result.1361107/
///<summary>
/// Compute the Delauny triangulation given a list of vertices/points using the bowyer-watson algorithm.
///</summary>
public static HashSet<Triangle> DelaunyTriangulation(List<Vector2> vertices)
{
// Initialize super triangle. Just a placeholder for now.
Triangle superTriangle = new Triangle(new Vector2(-100, -100f), new Vector2(100, -100f), new Vector2(0f, 100f));
List<Triangle> badTriangles = new List<Triangle>();
HashSet<Triangle> triangles = new HashSet<Triangle>() { superTriangle };
@unitycoder
unitycoder / Physics-Notes.md
Last active January 30, 2023 12:39
Unity Physics



Update and FixedUpdate may be seen as two separate execution paths, not necessarily "after" or "before" each other.

Update

  • Executes on each visually presented frame. When you see 134 FPS in the stats it means 134 Update cycles per second.
  • Time.deltaTime is the time between one update cycle to another.
  • Updated for Unity 2020.2: If VSync is enabled then Update is called at the display's refresh rate and Time.deltaTime is the time between each frame presentation (typically 1 / refresh rate).
  • Frames may be skipped sometimes if the cpu/gpu load can't keep the display rate.
@unitycoder
unitycoder / Worlds.cs
Created November 12, 2022 20:53 — forked from andrew-raphael-lukasik/Worlds.cs
(dots) code for world serialization and deserialization
// src: https://gist.github.com/andrew-raphael-lukasik/66d898be737734f26e607e6526d22901
using IO = System.IO;
using UnityEngine;
using Unity.Entities;
using Unity.Scenes;
using Unity.Entities.Serialization;
public static class Worlds
{
@unitycoder
unitycoder / BillboardVerticalZDepth.shader
Created November 11, 2022 17:23
BillboardVerticalZDepth shader
// https://forum.unity.com/threads/problem-solving-2d-billboard-sprites-clipping-into-3d-environment.680374/#post-5689456
Shader "Unlit/BillboardVerticalZDepth"
{
    Properties
    {
        _MainTex("Texture", 2D) = "white" {}
    }
 
    SubShader
    {
@unitycoder
unitycoder / otf vs ttc.txt
Created November 11, 2022 06:57
otf vs ttc
The "Noto Sans CJK Regular.otf" file contains a single font
whereas the "NotoSansCJK-Regular.ttc" contains a collection of fonts.
The reason this matters is because in the .otf file,
the font face for Regular would be at face index 0
whereas in the collection .ttc this regular face would be at some different index.
As such, when trying to load this face from the OS font,
the face at index 0 would not be the Regular.
When using Dynamic OS,
@unitycoder
unitycoder / FruityLoops.md
Last active March 20, 2024 14:46
Fruity Loops Notes FL Studio

Toggle keyboard as piano notes

  • ctrl+t (while in main view), typing keyboard to piano keyboard button below bpm

Install Plugin

  • Install normally after download
  • Restart FL Studio
  • Check Add/More plugins list
  • Or, Search in the Browser if its effect instead

free plugins

@unitycoder
unitycoder / PixelPerfectLineShader.shader
Created November 10, 2022 08:00
PixelPerfectLine Shader
// https://forum.unity.com/threads/linerenderer2d-gpu-pixel-perfect-2d-line-renderer-for-unity-urp-2d-renderer.1021708/#post-7663765
Shader "Unlit/PixelPerfectLineShader"
{
Properties
{
_Endpoint ("Endpoint", Vector) = (0, 0, 10, 10)
_Thickness ("Thickness", float) = 1
_BlockSize ("BlockSize", int) = 1
}
SubShader
@unitycoder
unitycoder / nodevs.md
Last active November 9, 2022 19:52
Node.js in Visual Studio 2022
@unitycoder
unitycoder / Mastodon.md
Last active November 8, 2022 12:25
Mastodon Notes UX/UI

Overall first impressions: "Its like Blender UI"

Website

  • Quite slow to load..
  • Federate timeline: Items keep appearing in random order, while im currently reading one post..?

UX

  • Cannot drag and drop avatar image to upload (browse folder to upload is quite 1990)
  • Profile: Display name field is empty, does it mean i dont have any?
  • Big black box below bio and clicking it takes you to your profile page..why?