Skip to content

Instantly share code, notes, and snippets.

View ciwolsey's full-sized avatar

Carl Wolsey ciwolsey

  • Yorkshire, England
View GitHub Profile
@ciwolsey
ciwolsey / track.cs
Created August 24, 2019 09:49
Tracking
namespace Interakt.Utility {
using UnityEngine;
public class Tracking
{
// Rotates the source rigidbody towards the target transforms rotation at RotationSpeed
public static void RotateRBTowardsTransform(Rigidbody source, Transform target, float RotationSpeed)
{
var delta = target.rotation * Quaternion.Inverse(source.rotation);
delta.ToAngleAxis(out float _angle, out Vector3 _axis);
using Valve.VR;
using UnityEngine;
using UnityEngine.Events;
public class SteamVRBooleanAction : MonoBehaviour
{
public SteamVR_Action_Boolean InputAction;
public SteamVR_Input_Sources InputSource;
[System.Serializable]
public class Changed : UnityEvent<bool> {}
using Valve.VR;
using UnityEngine;
using UnityEngine.Events;
public class SteamVRBooleanToZinnia : MonoBehaviour {
public SteamVR_Action_Boolean SteamVR_Input_Action;
public SteamVR_Input_Sources Source;
[System.Serializable]
public class Changed : UnityEvent<bool> {}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Interakt.Components.Constraints {
public class ConstrainRotationAxis : MonoBehaviour
{
public enum ConstraintSpace {
Local,
World
use cpal;
use cpal::EventLoop;
use std::thread;
use std::time::Duration;
use std::sync::mpsc;
mod osc;
fn main() {
let event_loop = EventLoop::new();
@ciwolsey
ciwolsey / audiogen.cs
Created June 4, 2019 19:28
audiogen.cs
void OnAudioFilterRead(float[] data, int channels)
{
for(int i = 0; i < data.Length; i+= channels)
{
data[i] = CreateSine(timeIndex, frequency1, sampleRate);
if(channels == 2)
data[i+1] = CreateSine(timeIndex, frequency2, sampleRate);
timeIndex++;
@ciwolsey
ciwolsey / ScriptableObjectSingleton.cs
Last active March 26, 2019 16:38
Singleton Scriptable Object (Unity)
using UnityEngine;
// Singleton Scriptable Object
// Rename "OptionsSO" to something more appropriate
public class OptionsSO : ScriptableObject
{
// Scriptable Object Data
public enum Difficulty { Easy, Medium, Hard };
public Difficulty difficulty = Difficulty.Easy;
@ciwolsey
ciwolsey / ViveSprayCustomObjectLoading.md
Last active January 26, 2020 10:53
ViveSpray 2: Custom Object Loading

ViveSpray 2: Custom Object Loading

About

ViveSpray 2 allows for basic loading and painting of .obj files. Some points of note:

  • Only ".obj" is supported
  • The model must be UV mapped outside of ViveSpray
  • The model must only contain triangles and quads (n-gons may work but it's not supported right now)
  • Multiple objects are supported but nesting of objects isn't (but it still may work)
  • Each object within your .obj can be optionally assigned a paintable texture (2k or 4k depending on in-game options)
  • One material per object will be assigned
{
"alias_info" : {},
"bindings" : {
"/actions/default" : {
"chords" : [],
"haptics" : [],
"poses" : [],
"skeleton" : [],
"sources" : [
{
{
"actions": [
{
"name": "/actions/default/in/InteractUI",
"type": "boolean"
},
{
"name": "/actions/default/in/Teleport",
"type": "boolean"
},