News | Forum | People | FAQ | Links | Search | Register | Log in
Improved Collision Detection Using Ray-Triangle Intersect
Finally got off my lazy ass and created a git repo.

The quakespasm code is here
https://github.com/frabbani/quakespasm/tree/collision

The quakec code is here
https://github.com/frabbani/quakec/tree/collision

quakespasm source - added PF_trace_entity hook in pr_cmds.c which does a brute force ray triangle intersect test against the actual geometry. (see collision.h. mathlib.h and void Mod_LoadAliasCollision in gl_model.c )

quakec - added TraceEntities in trace.qc which uses trace_entity hook FireBullets uses this call to perform proper collision tests. As such, the main difference you will notice is the shotgun takes more shots than usual to kill enemies (and will sometimes miss them entirely).


I have an MSYS2 build working on my computer with the necessary dlls that I haven't added to my repo. For those of you who can build quakespasm, maybe you can benefit from my code.

NOTE: the code is unoptimized.
@bloodsnipe 
Seems like a cool feature for mods.

In the interest of engine compatibility, it would be good to see if this feature has already been implemented in other engines (most likely candidates are FTE or darkplaces) and if they have, to use the same builtin number and function signature.

If those engines do not have such a function, then you could find out what builtin numbers are not already used and pick one of those. This would help adoption of this feature by those other engines, by avoiding a conflict with other existing builtins.

The other thing that engines should do when adding new builtins is advertise their extensions using PF_checkextension. An example of that can be seen here: https://github.com/ezQuake/ezquake-source/blob/master/pr_cmds.c

(this last thing is a system that quakespasm doesn't have yet, because adding modding extensions hasn't been a focus.) 
 
Extension hooks are running low, umbers are running out. I fear increasing the number of supported extensions is non-trivial and will require changes to both source and QC.

I'm considering coming up with a way to overload one extension, using enums to determine which action to perform. IF this is possible, I can select one extension and add all my qc interface hooks to it. 
Is That True? 
I don't know that much about it, but it looks like PF_checkextension takes a string, and builtin numbers are ints? Seems like those allow for as many new strings and numbers as we would need. Is there some place in the quakec pipeline that forces it to a single byte or something? 
 
The funny thing about per-triangle collision is that it's certainly made for people who plays with autoaim off. With autoaim enabled, per-poly collision shouldn't make much of a difference. 
 
@metlsime i see. It appears so that there is a way to extend the number of reserved extensions for quakec. The quakespasm source I branched off of doesnt have PF_checkextension, I may have to lift it from ezquake

#mankrip. true. I played as a sniper back in the day and I had always wanted to make the sniping experience more realistic. My code as it stands is Proof Of Concept, and there is more logic in quakec than what I want.

I also want to add object oriented bounding boxes (OOBB) to make projectiles like nails more accurate. The new md5s have skeletal meshes, so it is possible I can construct boxes around the bones and export them as frames for testing.

Wish me luck. 
You must be logged in to post in this thread.
Website copyright © 2002-2024 John Fitzgibbons. All posts are copyright their respective authors.