You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: SAT.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@
4
4
//
5
5
// A simple library for determining intersections of circles and
6
6
// polygons using the Separating Axis Theorem.
7
-
/** @preserve Copyright 2013 - Jim Riecken <jimr@jimr.ca> - released under the MIT License. */
7
+
/** @preserveSAT.js - Version 0.2 - Copyright 2013 - Jim Riecken <jimr@jimr.ca> - released under the MIT License. https://github.com/jriecken/sat-js */
<p>Drag the shapes around. If they collide they will be moved so that they don't collide. The circle is "heavy" - it will not be moved by other items (but will move other items)</p>
// onTick handler that restores "non collided" color
16
+
functionrestoreNoCollisionColors(){
17
+
this.displayAttrs.fill='#CCC';
18
+
}
19
+
// Default entity options that will just highlight entities when they overlap
20
+
vardefaultEntityOptions={
21
+
solid: false,
22
+
draggable: true,
23
+
onCollide: displayCollision,
24
+
onTick: restoreNoCollisionColors
25
+
};
26
+
</script>
27
+
</head>
28
+
<bodystyle="margin: 50px">
29
+
<h1>Simple Collision Examples</h1>
30
+
<p>Drag the shapes around. The shapes will turn red when they are colliding. The smaller shape will turn green if it is completely inside the larger one.</p>
0 commit comments