Skip to content

Instantly share code, notes, and snippets.

@takashiski
takashiski / Wheel
Created July 29, 2014 20:21
Cubeの子にWheelColliderを自動生成して走らせる的な
using UnityEngine;
using System.Collections;
public class Wheel : MonoBehaviour {
public GameObject root;
public float wheelRadius;
public float steerAngle;
public float brakeTorque;
public float motorTorque;
@takashiski
takashiski / Gun
Created July 29, 2014 20:52
よく使う適当に何か飛ばすスクリプト
using UnityEngine;
using System.Collections;
public class Gun : MonoBehaviour {
public GameObject bullet;
public float offset;
public float power;
public ForceMode mode;
public float lifetime;
@takashiski
takashiski / NantokaFlag
Created October 4, 2014 14:41
Update内の処理を一度しか行わない方法
private bool nantokaFlag = true;
void Update()
{
if(nantokaFlag && ゲームオーバー条件)
{
nantokaFlag = false;
GameOver();
}
}
@takashiski
takashiski / VelocityChecker
Created November 29, 2014 23:34
Oculus riftの上下に揺れて進むあれ
using UnityEngine;
using System.Collections;
using Ovr;
public class VelocityChecker : MonoBehaviour {
Hmd hmd;
float prevVelY;
// Use this for initialization
void Start () {
@takashiski
takashiski / AppManager
Created December 1, 2014 05:28
タイトル画面やリザルト画面ででアプリケーションを終了したり、特定のシーンに飛んだりするためによく使うやつ
using UnityEngine;
using System.Collections;
public class AppManager : MonoBehaviour {
public string jumpSceneName = "Title";
public KeyCode jumpSceneKey = KeyCode.Return;
public KeyCode quitAppKey = KeyCode.Escape;
@takashiski
takashiski / UpVelocityMover
Created December 6, 2014 16:41
上下方向加速度で前に進ませるやつ改
using UnityEngine;
using System.Collections;
using Ovr;
public class UpVelocityMover : MonoBehaviour {
Hmd hmd;
void Start () {
hmd = OVRManager.capiHmd;
@takashiski
takashiski / poweroff
Last active August 29, 2015 14:22
自動消灯用スクリプト
import socket
import time
import sys
host = '192.168.1.10'
port = 8899
sleeptime = 10
serversock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
argv = sys.argv
argc = len(argv)
@takashiski
takashiski / preprocessor_fun.h
Created October 29, 2015 12:45 — forked from aras-p/preprocessor_fun.h
Things to commit just before leaving your job
// Just before switching jobs:
// Add one of these.
// Preferably into the same commit where you do a large merge.
//
// This started as a tweet with a joke of "C++ pro-tip: #define private public",
// and then it quickly escalated into more and more evil suggestions.
// I've tried to capture interesting suggestions here.
//
// Contributors: @r2d2rigo, @joeldevahl, @msinilo, @_Humus_,
// @YuriyODonnell, @rygorous, @cmuratori, @mike_acton, @grumpygiant,
@takashiski
takashiski / convertJSONArrayToCSV.js
Created December 17, 2016 18:03
convert JSON array to csv.
module.exports = function(jsonArray)
{
var json = jsonArray[0];
var keys = [];
for(var key in json)
{
keys.push(key);
}
@takashiski
takashiski / OLEDDebugger.h
Last active January 26, 2017 05:49
OLED(128x32)にシリアルと同じような感じで文字列吐き出す(ArduinoUNO,I2Cで試した)
#ifndef OLEDDEBUGGER_H
#define OLEDDEBUGGER_H
#include<Adafruit_GFX.h>
#include<Adafruit_SSD1306.h>
class OLEDDebugger{
public:
OLEDDebugger()
{