add terrain collision
This commit is contained in:
+2
-6
@@ -23,10 +23,6 @@ export default class Terrain {
|
||||
state() {
|
||||
return {
|
||||
...this,
|
||||
position: {
|
||||
x: this.x,
|
||||
y: this.y,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,8 +37,8 @@ export default class Terrain {
|
||||
const indicesToPolygon = (indices) => {
|
||||
const satPoints = [
|
||||
new SAT.Vector(...points.shape[indices[0]].toArray()),
|
||||
new SAT.Vector(...points.shape[indices[1]].toArray()),
|
||||
new SAT.Vector(...points.shape[indices[2]].toArray()),
|
||||
new SAT.Vector(...points.shape[indices[1]].clone().sub(points.shape[indices[0]]).toArray()),
|
||||
new SAT.Vector(...points.shape[indices[2]].clone().sub(points.shape[indices[0]]).toArray()),
|
||||
]
|
||||
|
||||
return new SAT.Polygon(satPoints[0], [new SAT.Vector(), satPoints[1], satPoints[2]])
|
||||
|
||||
Reference in New Issue
Block a user