Skip to content

Instantly share code, notes, and snippets.

@BlueMagnificent
BlueMagnificent / move.html
Created December 27, 2019 20:42
Javascript 3D Physics Tut 2 Base
<html>
<head>
<meta charset="utf-8">
<title>Move JS 3D Physics</title>
<style>
body { margin: 0; }
</style>
</head>
<body>
@BlueMagnificent
BlueMagnificent / index.html
Created April 3, 2019 08:31
Javascript 3D Physics Snippet Five
<html>
<head>
<meta charset="utf-8">
<title>JS 3D Physics</title>
<style>
body { margin: 0; }
</style>
</head>
<body>
<script src="js/three.js"></script>
@BlueMagnificent
BlueMagnificent / createJointObjects.js
Created April 3, 2019 08:23
Javascript 3D Create Joint Objects
function createJointObjects(){
let pos1 = {x: -1, y: 15, z: 0};
let pos2 = {x: -1, y: 10, z: 0};
let radius = 2;
let scale = {x: 5, y: 2, z: 2};
let quat = {x: 0, y: 0, z: 0, w: 1};
let mass1 = 0;
let mass2 = 1;
@BlueMagnificent
BlueMagnificent / index.html
Created April 3, 2019 07:49
Javascript 3D Physics Snippet Four
<html>
<head>
<meta charset="utf-8">
<title>JS 3D Physics</title>
<style>
body { margin: 0; }
</style>
</head>
<body>
<script src="js/three.js"></script>
@BlueMagnificent
BlueMagnificent / createMaskBall.js
Created April 3, 2019 07:36
Javascript 3D Create Mask Ball
function createMaskBall(){
let pos = {x: 1, y: 30, z: 0};
let radius = 2;
let quat = {x: 0, y: 0, z: 0, w: 1};
let mass = 1;
//threeJS Section
let ball = new THREE.Mesh(new THREE.SphereBufferGeometry(radius), new THREE.MeshPhongMaterial({color: 0x00ff08}));
@BlueMagnificent
BlueMagnificent / index.html
Last active July 31, 2021 18:54
Javascript 3D Physics Snippet Three
<html>
<head>
<meta charset="utf-8">
<title>JS 3D Physics</title>
<style>
body { margin: 0; }
</style>
</head>
<body>
@BlueMagnificent
BlueMagnificent / createPhysicsObjects.js
Created April 2, 2019 16:32
Javascript 3D Physics Object Creation
function createBlock(){
let pos = {x: 0, y: 0, z: 0};
let scale = {x: 50, y: 2, z: 50};
let quat = {x: 0, y: 0, z: 0, w: 1};
let mass = 0;
//threeJS Section
let blockPlane = new THREE.Mesh(new THREE.BoxBufferGeometry(), new THREE.MeshPhongMaterial({color: 0xa0afa4}));
@BlueMagnificent
BlueMagnificent / index.html
Created April 2, 2019 15:23
Javascript 3D Physics Snippet Two
<html>
<head>
<meta charset="utf-8">
<title>JS 3D Physics</title>
<style>
body { margin: 0; }
</style>
</head>
<body>
@BlueMagnificent
BlueMagnificent / setupGraphics.js
Last active July 31, 2021 18:03
Javascript 3D Physics Setup Graphics
function setupGraphics(){
//create clock for timing
clock = new THREE.Clock();
//create the scene
scene = new THREE.Scene();
scene.background = new THREE.Color( 0xbfd1e5 );
//create camera
@BlueMagnificent
BlueMagnificent / Index.html
Last active April 2, 2019 14:24
Javascript 3D Physics Snippet One
<html>
<head>
<meta charset="utf-8">
<title>JS 3D Physics</title>
<style>
body { margin: 0; }
</style>
</head>
<body>
<script src="js/three.js"></script>