I am currently working on a project using Rapier's JavaScript bindings. I am trying to check for intersections within a specified shape. I can't seem to get a response from the query I'm using.
var collider = this.world.createCollider(new RAPIER.ColliderDesc(new RAPIER.Cuboid(10, 10)))
collider.setActiveCollisionTypes(RAPIER.ActiveCollisionTypes.ALL)
collider.setActiveEvents(RAPIER.ActiveEvents.INTERSECTION_EVENTS)
collider.setSensor(true)
collider.setTranslation({x: 100, y: 100})
collider.setCollisionGroups(0xffffffff)
var shape = new RAPIER.Cuboid(10, 10);
var shapePos = { x:105, y: 100 };
var shapeRot = 0.1;
var groups = 0xffffffff;
this.world.intersectionsWithShape(shapePos, shapeRot, shape, groups, (handle) => {
console.log("The collider", handle, "intersects our shape.");
return true; // Return `false` instead if we want to stop searching for other colliders that contain this point.
});
I should be getting a single message in the output, saying that the collider intersects the shape, but I'm getting know such thing. I know the execution is moving forward; what am I doing wrong?