Skip to content

Instantly share code, notes, and snippets.

View kamend's full-sized avatar

Kamen Dimitrov kamend

View GitHub Profile
#! /bin/bash
#
# simple script to check for a given string pattern in any
# .c, .h, .cpp, .cxx, .m, & .mm source files
#
# Dan Wilcox <danomatika@gmail.com> 2014
#
# super simple command parsing
if [ $# -lt 1 -o "$1" == "-h" -o "$1" == "--help" ] ; then
@kamend
kamend / KinectCommonBridge Mesh Generation
Created April 4, 2014 09:58
This is how to generate point cloud mesh from the rawDepthPixels data, using Openframeworks and KinectCommonBridge
mesh.clear();
mesh.setMode(OF_PRIMITIVE_POINTS);
for(int x=0;x<640;x+=2) {
for(int y=0;y<480;y+=2) {
int index = x + y * 640;
short depth = kinect.getRawDepthPixelsRef().getPixels()[index];
if(depth > minDistance && depth < maxDistance) {
Vector4 world = NuiTransformDepthImageToSkeleton(x,y,kinect.getRawDepthPixelsRef().getPixels()[index] << 3,NUI_IMAGE_RESOLUTION_640x480);
float scale = 500.0f;
mesh.addVertex(ofVec3f(world.x,world.y,-world.z)*scale);
// by dave @ beesandbombs.tumblr.com >:)
void setup() {
setup_();
result = new int[width*height][3];
result_ = new int[width*height][3];
}
int[][] result, result_;
float time;
// Adjust dSYM generation
var xcodeProjectPath = Path.Combine(xcodeProjectDir, "Unity-iPhone.xcodeproj");
var pbxPath = Path.Combine(xcodeProjectPath, "project.pbxproj");
var sb = new System.Text.StringBuilder();
var xcodeProjectLines = File.ReadAllLines(pbxPath);
foreach (var line in xcodeProjectLines)
{
// Remove from OTHER_LDFLAGS
@kamend
kamend / Image2Tumblr.cs
Created May 24, 2014 07:06
How post an image to Tumblr via their V2 API, inside Unity
using UnityEngine;
using System;
using System.Text;
using System.Collections;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using System.Globalization;
using System.Security.Cryptography;
using System.IO;
//#define DEBUG_THREADING
using UnityEngine;
using System.Collections;
using System.Threading;
using System.Reflection;
public delegate IEnumerator MonitorCoroutine<T> (CoroutineData<T> data);
using System;
using System.Collections.Generic;
using UnityEngine.Events;
// interface you implement in your MB to receive events
public interface ICustomHandler : IEventSystemHandler
{
void OnCustomCode(CustomEventData eventData);
}
using System.Collections.Generic;
using System.Text;
namespace UnityEngine.EventSystems
{
public abstract class PointerInputModule : BaseInputModule
{
public const int kMouseId = -1;
public const int kFakeTouchesId = -2;
@kamend
kamend / AssetProcessing.cs
Last active August 8, 2016 13:29
Unity: An example how to set different Texture options based on the import directory. Copy this in the Editor folder.
using UnityEngine;
using UnityEditor;
public enum TextureType {
NONE = -1,
GUI = 0,
CHARACTERS = 1
}
public class AssetProcessing : AssetPostprocessor {
@kamend
kamend / RaycastCollisionDetection.cs
Created September 27, 2015 16:11 — forked from NickDiMucci/RaycastCollisionDetection.cs
Raycast collision detection in Unity from a box collider, with diagonal raycasts from the corners to guard against corner collisions.
using com.mindshaft.overtime.collision;
using UnityEngine;
namespace com.mindshaft.overtime.physics {
public class RaycastCollisionDetection : IEntityCollisionDetection {
private BoxCollider _collider;
private Rect _collisionRect;
private LayerMask _collisionMask;
private LayerMask _playerMask;