This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//following two rotation functions are updated versions of code from: https://github.com/mrdoob/three.js/issues/1219 | |
//updated to work in latest versions (r52 tested) of THREE.js | |
// Rotate an object around an axis in object space | |
var rotationMatrix | |
function rotateAroundObjectAxis( object, axis, radians ) { | |
rotationMatrix = new THREE.Matrix4(); | |
rotationMatrix.makeRotationAxis( axis.normalize(), radians ); | |
object.matrix.multiplySelf( rotationMatrix ); // post-multiply | |
object.rotation.setEulerFromRotationMatrix(object.matrix, object.order); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var X_AXIS = new THREE.Vector3(1,0,0); //arbitrary vector local to object | |
var focusVector = new THREE.Vector3(); | |
var localRot = new THREE.Quaternion(); | |
//convert local rotation from Euler to Quaternion and store it in localRot | |
localRot.setFromEuler(object.mesh.rotation); | |
//multiply to quat by the vector we want to cast the ray towards (locally to the casting object) | |
//store resulting vector in focusVector | |
localRot.multiplyVector3(X_AXIS, focusVector); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
float x = 100; | |
float y = 100; | |
float xSpeed = 1; | |
float ySpeed = 3.3; | |
void setup(){ | |
size(200,200); | |
smooth(); | |
background(255); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int x = 100; | |
int y = 100; | |
color circleColour = color(0,0,0); | |
void setup(){ | |
size(200,200); | |
noStroke(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// attach this script to the OVRCameraController prefabs parent object | |
// add a rigid body to the OVRCameraController prefabs parent object | |
// turn gavity off on the rigidbody | |
// !! requires purchase of Uniduino from the asset store; | |
using UnityEngine; | |
using System.Collections; | |
using Uniduino; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void setup(){ | |
size(500,500); | |
} | |
void draw(){ | |
//draw a drop at 120, 120 size 8 | |
drawRaindrop(120,120,8); | |
} | |
//draw raindrop x = x position, y = y positiom, size = size |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void setup() { | |
size(500, 500); | |
background(255, 0, 0); | |
} | |
void draw() { | |
background(255, 0, 0); | |
fill(0, 0, 255); | |
ellipse(250, 250, 50, 50); | |
color myColor = get(mouseX, mouseY); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ddf.minim.*; | |
Minim minim; | |
AudioSample skid; | |
void setup() | |
{ | |
size(512, 200); | |
minim = new Minim(this); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//tests if mouse button is pressed and where the mouse is on the screen | |
//changes background color accordingly | |
void setup(){ | |
size(500,500); | |
background(255,0,0); | |
} | |
void draw(){ | |
//top left quater of screen && mouse pressed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int xPos = 0; | |
int speed = 4; | |
void setup(){ | |
size(300,300); | |
} | |
void draw(){ | |
background(150,150,150); |
OlderNewer