Re: [Quake-C] Tracebox / Traceline
Quake C mods and support - SSQC / CSQC
Brought to you by:
teknoskillz
From: Cobalt <co...@te...> - 2016-02-06 22:22:00
|
Another thing with tracebox. I was told a while back that you are limited to collisoins with it to the 3 standard point, player and shambler hitbox sizes when looking to collide with those size ents. After doing some tests with Darkplaces , and making the setmodelrealbox cvar 1, I edited the Grenades spawn so that it has a new entity following it as a movetype_follow, basicly a shadow ent , like how Frikbot uses for the phys_obj ents to do some physics hacks. Only this case I am giving it the new DP solid (5) / SOLID_CORPSE. This basicly makes it a SOLID_TRIGGER allowing other ents to pass thru it, while at the same time I believe it is more or less a DAMAGE_AIM for taking damage. I assign it a DAMAGE_AIM anyway just to be sure, plus a health of 3, and its th_die equal to GrenadeExplode (). I set its dest1 and dest2 vector fields to be that of the grenades realhitbox size using mins and maxs...however I set the grenade point size afterwards and dont setsize the shadow ent as of yet. >From here theres a couple of ways to go, give the shadow ent its own think and call the tracebox every frame, or use another tool , such as Gyro, and have it look for your shadow ent in its physics routine. I used Gyro so its checking the tracebox every frame. So far I dont see any glitches, and the grenade now has a "hacked" hitbox so to speak , where you can add in shotgun hits that use traceline, and the grenade will take damage from the hits and detonate, even in mid air. The concept of point to point collision in Quake must never happen, because after all my years playing, never have I see a grenade hit another grenade or a rocket to rocket or any combination thereof. Point collisoin must be a different calculation in the engine I guess. Basicly my traceline for checking the shadow ent is: if (other.flags & FL_EXPLOSIVE && !other.size) // The ent being looked at (other) is an explosive and has a point size. (new.flag FL_EXPLOSIVE needs to be created) { tracebox(realorigin (other), other.dest1, other.dest2, realorigin(other), 3, other); if (!trace_startsolid) { if (other.movetype == MOVETYPE_FOLLOW) // Just a reinforcement to make sure its the shadow ent { if (other.aiment.classname == "missile") // Shadows aiment is the grenade as per specs for movetype_follow setsize (other, other.dest1 * 0.25, other.dest2 * 0.25); // size the shadow 25% less than the grenades actual saved hitbox mins/maxs else setsize (other, other.dest1 * 0.66, other.dest2 * 0.66); // reduce smaller for the rocket. } So even though my dest1 and dest2 are non point, player or shambler sizes, we are ok so far in my tests. I suppose if the missile winds up spawning in a tight corner, close to a wall , there is a higher chance of failure it seems, as I guess the traceline is using trace_plane_normal down at the engine level here, and when you get fractional values, this is where Quake bugs out because of Q1bsp's leaf and clipbrush system I believe. However I dont see why we cant go down in fractional values to calculate collisions in those cases. But thats more an engine topic. |