diff --git a/matter-js/matter-js-tests.ts b/matter-js/matter-js-tests.ts
new file mode 100644
index 000000000..cc9b7d99d
--- /dev/null
+++ b/matter-js/matter-js-tests.ts
@@ -0,0 +1,57 @@
+///
+
+var Engine = Matter.Engine,
+ World = Matter.World,
+ Body = Matter.Body,
+ Bodies = Matter.Bodies,
+ Composites = Matter.Composites,
+ Constraint = Matter.Constraint,
+ Events = Matter.Events,
+ Query = Matter.Query
+
+
+var engine = Engine.create(document.body)
+
+//Bodies
+var box1 = Bodies.rectangle(400,200,80,80)
+var box2 = Bodies.rectangle(400,610,810,60, {
+ angle: 10,
+ angularSpeed: 11,
+ angularVelocity: 1,
+ density: 4,
+ isStatic: true
+})
+
+var circle1 = Bodies.circle(100,100,50)
+
+World.addBody(engine.world, box1)
+World.add(engine.world, [box2, circle1])
+
+
+//Composites
+var stack = Composites.stack(0, 100, 5, 1, 20, 0, function(x, y, column, row) {
+ return Bodies.circle(x, y, 75, { restitution: 0.9 });
+ });
+
+World.add(engine.world, stack);
+
+//Constraints
+var constraint1 = Constraint.create({
+ bodyA: box1,
+ bodyB: box2,
+ stiffness: 0.02
+})
+
+//Query
+var collisions = Query.ray([box1, box2, circle1], {x:1, y:2}, {x:3, y:4});
+
+World.addConstraint(engine.world, constraint1)
+
+
+//events
+Events.on(engine, "beforeTick", (e:any)=>{
+
+})
+
+
+Engine.run(engine)
diff --git a/matter-js/matter-js.d.ts b/matter-js/matter-js.d.ts
index 1365ccca2..5c4426ea2 100644
--- a/matter-js/matter-js.d.ts
+++ b/matter-js/matter-js.d.ts
@@ -44,7 +44,7 @@ declare module Matter
{
/**
* Clears the engine including the world, pairs and broadphase.
- * @param engine
+ * @param engine
*/
static clear(engine:Engine):void;
@@ -844,6 +844,30 @@ declare module Matter
*/
type?:string;
}
+
+ export class Query
+ {
+ /**
+ * Casts a ray segment against a set of bodies and returns all collisions, ray width is optional. Intersection points are not provided.
+ *
+ * @param bodies
+ * @param startPoint
+ * @param endPoint
+ * @param [rayWidth]
+ *
+ * @returns Object[] Collisions
+ */
+ static ray( bodies:Array
, startPoint:Vector, endPoint:Vector, rayWidth?:number ):Array;
+
+ /**
+ * Returns all bodies whose bounds are inside (or outside if set) the given set of bounds, from the given set of bodies.
+ *
+ * @param bodies
+ * @param bounds
+ * @returns Body[] The bodies matching the query
+ */
+ static region( bodies:Array, bounds:Bounds, outside?:boolean ):Array;
+ }
export class Mouse
{