CheeseLord / warts

WAcky Real Time Strategy
MIT License
1 stars 0 forks source link

Mouse click screen-to-world calculation is absurd #54

Closed kronmillerg closed 7 years ago

kronmillerg commented 7 years ago

After converting the screen coordinate to a ray in the world using CollisionRay.setFromLens, we iterate through all objects that collide with that ray, checking each one to see if it's the ground plane. This is obviously an absurd way to do this, which we did only because at the time we couldn't figure out how to just intersect the ray and the plane directly.

I found a forum thread that claims to provide what we were looking for from the start. The method in question is Plane.intersectsLine.

Guys, I think we can fix this.