//for(let wall of scene)
moveAngle(this,this.gravAngle,1)
if(this.floorDect.hits(_floor,project.hitTestOptions)){
let hit = this.floorDect.hits(_floor,project.hitTestOptions)
this.gravAngle = Math.atan2(hit.overlapY, hit.overlapX)
this.walkAngle = Math.atan2(
hit.intersections[1].y-hit.intersections[0].y,
hit.intersections[1].x-hit.intersections[0].x
)
moveAngle(this,this.gravAngle-180,1)
}
if(isKeyDown(“d”)){
this.x+= Math.cos(this.walkAngle)*this.speed
this.y+= Math.sin(this.walkAngle)*this.speed
}
if(isKeyDown(“a”)){
this.x-= Math.cos(this.walkAngle)*this.speed
this.y-= Math.sin(this.walkAngle)*this.speed
}
so in my player clip there is a brown box called floorDect
Im using convex collions and am trying to get the 2 points where it this the ground so i an then use that to get an angle so the player can run up slopes.
I think im using the intersection array wrong?