Skip to content

Instantly share code, notes, and snippets.

@mmj-the-fighter
mmj-the-fighter / rubixcubefragmentshader.fsh
Last active October 25, 2015 10:42
Shader for painting cube faces with respect to the direction of the vertex normal . ( March 2012 )
//Copyright © 2015 Manoj M J
//All Rights Reserved
//Why I do copyright the code that I provide at gist.github.com
//( https://gist.github.com/mmj-the-fighter/bccd0a7ff57c638beee8 )
//Development History:
//Authored on : Monday, July 04, 2011 using ShaderDesigner
//Posted to my blog on, July 05, 2011 http://www.gamedev1001.blogspot.in/2011/07/gpu-programming.html
//Posted to gamedev.net on March 25, 2012 http://www.gamedev.net/topic/622385-a-free-shader/
@mmj-the-fighter
mmj-the-fighter / TransformCopier.cs
Last active October 25, 2015 10:28
A Unity3D Editor script for copying and pasting local or global positons and rotations. And other convenient methods.
//Copyright © 2015 Manoj M J
//All Rights Reserved
//Why I do copyright the code that I provide at gist.github.com
//( https://gist.github.com/mmj-the-fighter/bccd0a7ff57c638beee8 )
/*
* File:/Editor/TransformCopier.cs - A utility for copying and pasting local or global positons and rotations.
* The method CopyTransformToClipboard is useful for pasting the transform to text file.
* The copy - paste of scale is avoided since global scale(lossy scale) is a read only property.
@mmj-the-fighter
mmj-the-fighter / DropObject.cs
Last active October 25, 2015 10:22
Unity3D Editor Script: Moves selected object downwards till it touches the ground
//Copyright © 2015 Manoj M J
//All Rights Reserved
//Why I do copyright the code that I provide at gist.github.com
//( https://gist.github.com/mmj-the-fighter/bccd0a7ff57c638beee8 )
/*
* DropObject.cs - Moves selected object downwards till it touches the ground
* This is useful for placing 3d models on scene.
* TODO:Add Spherecast in addition to Raycast
@mmj-the-fighter
mmj-the-fighter / ShadersLister.cs
Last active October 25, 2015 10:24
Unity3D Editor Script : Displays gameobjects linked to each shader present in a scene.
//Copyright © 2015 Manoj M J
//All Rights Reserved
//Why I do copyright the code that I provide at gist.github.com
//( https://gist.github.com/mmj-the-fighter/bccd0a7ff57c638beee8 )
/*
* ShadersLister.cs - Displays gameobjects linked to each shader present in a scene.
* It is useful for checking if the scene contains any unwanted shaders.
*/
@mmj-the-fighter
mmj-the-fighter / DebugConnectionManager.cs
Last active March 1, 2024 16:05
An example of how a Unity3D game can be programmed for accepting commands over a LAN and perform actions on those commands.
Moved to GitHub:
https://github.com/mmj-the-fighter/DCM
@mmj-the-fighter
mmj-the-fighter / TransformTreePreOrderTraversor.cs
Last active August 27, 2017 23:00
Algorithm for traversing a game object hierarchy tree in pre-order in Unity3D
//Copyright © 2015 Manoj M J
//All Rights Reserved
using UnityEngine;
using System.Collections;
public class TransformTreePreOrderTraversor : MonoBehaviour
{
void Start () {
TraverseInPreOrder(this.gameObject.transform);
Here in this file, I am explaining the reasons for putting
"All Rights Reserved" notice.
This may be because of some or all of the following reasons.
- I cannot put the code in public domain, some one else may copy it and copyright it and there after I may not modify and redistribute it.
- The code I made may be not of professional quality.
- I am only demonstrating an idea and / or an approach of problem solving
- Or it is a mere collection of some data useful for development purpose
- Or it may be a work in progress, published only for preview
@mmj-the-fighter
mmj-the-fighter / ComponentLister.cs
Last active August 5, 2017 14:27 — forked from AngryAnt/ComponentLister.cs
An extension to example code for "Where did that component go?" from AngryAnt
/*
* Displays gameobjects linked to each script present in a scene, useful for development and debugging.
* Added features:
* You can search for a particular component, and turn off UnityEngine componets from displaying.
* While searching you don't have to type the entire name.
*/
using UnityEngine;
using UnityEditor;
using System.Collections;
@mmj-the-fighter
mmj-the-fighter / broadcastclient.c
Last active January 16, 2024 14:36
server and client for udp broadcasting, useful for server discovery.
#if defined(_WIN32)
#define BUILD_FOR_WINDOWS
#endif
#ifdef BUILD_FOR_WINDOWS
#pragma warning(disable:4996)
#define _WINSOCK_DEPRECATED_NO_WARNINGS
#endif
#include <stdio.h>
@mmj-the-fighter
mmj-the-fighter / SlideCameraOnCollision.cs
Last active August 5, 2017 15:48
A method to slide camera along an obstacle in a 3D world.
//Copyright © 2017 Manoj M J
//All Rights Reserved
/*
A method to slide camera along an obstacle.
Note: This script uses Unity3D game engine api and libraries.
*/
void SlideCameraOnCollision(
Vector3 obstacleNormal,
Vector3 cameraForward,