toji / webgl-quake3

WebGL Quake 3 level renderer
http://media.tojicode.com/q3bsp
265 stars 62 forks source link

Curved meshes missing collision? #20

Closed victorbstan closed 1 year ago

victorbstan commented 1 year ago

Hi, I noticed you have a few branches in progress, including one to use ammo.js and three.js for physics and rendering, so maybe this is a moot point (not sure what state of completion that branch is in?) but I noticed that for all surfaces that are curved, perhaps because they are made from the Q3 patches, are not processed by the collision mesh generating script perhaps? So the player character clips & falls through curved walls quite readily.

I guess this post doubles as a question somewhat: If you are aware of this issue, do you remember by any chance if it's an issue with collision detection by the character, or like I mentioned above, the collision surface generation process? And, is it worth exploring a fix in the "main" branch, or working with the "exporter" branch?

toji commented 1 year ago

Honestly it's been years since I've done anything other than minor spot-fixes for this repo, so I really don't recall. If I were to guess it's likely because I didn't have any code that handled curved surfaces as a special case for collisions. If it wasn't necessary for the main demo to work (which means just player walking collisions) then I probably didn't put a lot of time into it back in the day.

Not sure which branch I'd recommend working off of either. I have a fuzzy recollection that the exporter branch was an effort to transcode the q3bsp format into something more web-friendly so it could load faster, but I don't really recall beyond that. (The main branch loads directly from the original map format, with only a couple of very minor changes to textures to allow them to load cleanly in WebGL 1)

victorbstan commented 1 year ago

Thanks for the update, I'm currently trying (on master branch) to rewrite the buffer creation method to return the vertices and indexes values as params in qbsp.js, and eventually feed those to Three.js to display the mesh.