Skip to content

Instantly share code, notes, and snippets.

@BlueMagnificent
Last active August 3, 2020 16:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BlueMagnificent/8cda69c726e9a9e6ebeafa8a3d6072a3 to your computer and use it in GitHub Desktop.
Save BlueMagnificent/8cda69c726e9a9e6ebeafa8a3d6072a3 to your computer and use it in GitHub Desktop.
Javascript 3D Physics Tut 3 Setup Contact Pair Result Callback
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 );
const distance = contactPoint.getDistance();
if( distance > 0 ) return;
this.hasContact = true;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment