JSFiddle - React, Tailwind, and code Playground
HTML
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
<script src="https://aframe.io/releases/0.5.0/aframe.min.js"></script>
<script src="//cdn.rawgit.com/donmccurdy/aframe-extras/v2.3.0/dist/aframe-extras.min.js"></script>
<a-scene physics="restitution:0.5">
<!-- Camera -->
<a-entity camera universal-controls position="0 1 0"></a-entity>
<!-- Floor -->
<a-grid static-body position="0 0 0"></a-grid>
<!-- Dynamic box -->
<a-entity geometry="box" id="cannon" dynamic-body position="1 3 -8" width="1" height="1" depth="1" color="#33AA33"></a-entity>
<!-- Dynamic box -->
<a-entity geometry="box" id="nonbounce" dynamic-body position="-1 3 -8" width="1" height="1" depth="1" color="#33AA33"></a-entity>
</a-scene>
JavaScript
$(document).ready(function(){
// multiple getComputedAttribute errors, clear
console.clear();
// Get the CANNON.world reference
var world = $('a-scene')[0].systems.physics.world;
console.log(world);
// create two custom materials, and add them to the boxes:
var firstMaterial = new CANNON.Material("firstMaterial");
var secondMaterial = new CANNON.Material("secondMaterial");
$('#cannon')[0].body.material=firstMaterial;
$('floor')[0].body.material=secondMaterial;
//create a contact material and add it to the world
var secondCM = new CANNON.ContactMaterial(firstMaterial,secondMaterial,
[restitution = 2]);
console.log(secondCM);
world.addContactMaterial(secondCM);
console.log(document.querySelector("#cannon").body.material);console.log(document.querySelector("#nonbounce").body.material);
});