Precise Collision Detection

  • November 2019
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Precise Collision Detection as PDF for free.

More details

  • Words: 33
  • Pages: 1
function precisecollision(colobj1,colobj2,step):boolean { if(colobj1.hittestobject(colobj2)==true) { //trace("checking collisions"); for (i=colobj1.x;i<(colobj1.x+colobj1.width);i +=step) { for (j=colobj2.y;j<(colobj2.y+colobj2.height);j+=step) { nrofpixels +=1; //trace("x"+i +"y"+j); if (colobj1.hittestpoint(math.round(i),math.round(j),true) && colobj2.hittestpoint(math.round(i),math.round(j),true)) { return true; break; } } } } return false; }

Related Documents