Skip to content

Instantly share code, notes, and snippets.

View gist:4a80f31f1c5e1f8a0ebe0e018d1fe74a
var mediaJSON = { "categories" : [ { "name" : "Movies",
"videos" : [
{ "description" : "Big Buck Bunny tells the story of a giant rabbit with a heart bigger than himself. When one sunny day three rodents rudely harass him, something snaps... and the rabbit ain't no bunny anymore! In the typical cartoon tradition he prepares the nasty rodents a comical revenge.\n\nLicensed under the Creative Commons Attribution license\nhttp://www.bigbuckbunny.org",
"sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4" ],
"subtitle" : "By Blender Foundation",
"thumb" : "images/BigBuckBunny.jpg",
"title" : "Big Buck Bunny"
},
{ "description" : "The first Blender Open Movie from 2006",
"sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ElephantsDream.mp4" ],
@BlueMagnificent
BlueMagnificent / contact_pair_test.html
Last active Oct 17, 2021
Javascript 3D Physics Tut 3 Contact Pair Test
View contact_pair_test.html
<html>
<head>
<meta charset="utf-8">
<title>Collision JS 3D Physics</title>
<style>
body { margin: 0; }
</style>
</head>
<body>
@BlueMagnificent
BlueMagnificent / handleKeyDown.js
Created Aug 3, 2020
Javascript 3D Physics Tut 3 Handle Key Down
View handleKeyDown.js
function handleKeyDown(event){
let keyCode = event.keyCode;
switch(keyCode){
case 87: //W: FORWARD
moveDirection.forward = 1;
break;
@BlueMagnificent
BlueMagnificent / jump.js
Created Aug 3, 2020
Javascript 3D Physics Tut 3 Jump
View jump.js
function jump(){
cbContactPairResult.hasContact = false;
physicsWorld.contactPairTest(ball.userData.physicsBody, redTile.userData.physicsBody, cbContactPairResult);
if( !cbContactPairResult.hasContact ) return;
let jumpImpulse = new Ammo.btVector3( 0, 15, 0 );
@BlueMagnificent
BlueMagnificent / setupContactPairResultCallback.js
Last active Aug 3, 2020
Javascript 3D Physics Tut 3 Setup Contact Pair Result Callback
View setupContactPairResultCallback.js
function setupContactPairResultCallback(){
cbContactPairResult = new Ammo.ConcreteContactResultCallback();
cbContactPairResult.hasContact = false;
cbContactPairResult.addSingleResult = function(cp, colObj0Wrap, partId0, index0, colObj1Wrap, partId1, index1){
let contactPoint = Ammo.wrapPointer( cp, Ammo.btManifoldPoint );
@BlueMagnificent
BlueMagnificent / contact_test_one.html
Last active Aug 3, 2020
Javascript 3D Physics Tut 3 Contact Test One
View contact_test_one.html
<html>
<head>
<meta charset="utf-8">
<title>Collision JS 3D Physics</title>
<style>
body { margin: 0; }
</style>
</head>
<body>
<script src="js/three.js"></script>
@BlueMagnificent
BlueMagnificent / setupContactResultCallback.js
Last active Aug 3, 2020
Javascript 3D Physics Tut 3 Setup Contact Result Callback
View setupContactResultCallback.js
function setupContactResultCallback(){
cbContactResult = new Ammo.ConcreteContactResultCallback();
cbContactResult.addSingleResult = function(cp, colObj0Wrap, partId0, index0, colObj1Wrap, partId1, index1){
let contactPoint = Ammo.wrapPointer( cp, Ammo.btManifoldPoint );
const distance = contactPoint.getDistance();
@BlueMagnificent
BlueMagnificent / contact_test.html
Last active Aug 3, 2020
Javascript 3D Physics Tut 3 contact test
View contact_test.html
<html>
<head>
<meta charset="utf-8">
<title>Collision JS 3D Physics</title>
<style>
body { margin: 0; }
</style>
</head>
<body>
@BlueMagnificent
BlueMagnificent / contact_manifold_check_two.html
Last active Nov 16, 2021
Javascript 3D Physics Tut 3 contact manifold check two
View contact_manifold_check_two.html
<html>
<head>
<meta charset="utf-8">
<title>Collision JS 3D Physics</title>
<style>
body { margin: 0; }
</style>
</head>
<body>
@BlueMagnificent
BlueMagnificent / contact_manifold_check_one.html
Last active Aug 3, 2020
Javascript 3D Physics Tut 3 Contact Manifold Check One
View contact_manifold_check_one.html
<html>
<head>
<meta charset="utf-8">
<title>Collision JS 3D Physics</title>
<style>
body { margin: 0; }
</style>
</head>
<body>