View Single Post
Old 03-22-2010, 12:30 AM   #1
Join Date: Apr 2004
Posts: 19
Complete Explanation of trap_Trace Results...


I've been working on a mode for some time now, and it is almost ready to be published. The biggest problem i have is that occasionally while moving an item with the force it gets stuck inside the floor or the wall, and my trap_Trace() function is not determining the correct result, thus the sound engine keeps playing the *bounce* sound as if the item is bouncing, but it isn't, it ricocheting back and forth off the top and bottom of the inside of the map face.

So. I would like it if someone could explain in full detail the results of the trap_Trace function (basically what is stored in the trace_t structure)

Like for example:
My predictive trap_trace looks forward along the movement trajectory 24 units. i set the mins to -ITEM_RADIUS and the maxs to ITEM_RADIUS

trap_Trace(&tr, oldOrigin, mins, maxs, compareOrigin, movingEntityNum, MASK_PLAYERSOLID);

in this i check for tr.Fraction !=1 || tr.startsolid || tr.allsolid
however, in some circumstances the startsolid is ill-flagged in this attempts so I do a second trace:
trap_Trace(&tr, oldOrigin, NULL, NULL, compareOrigin, movingEntityNum, MASK_PLAYERSOLID);

If the tr.startsolid is still true, i should cancel the move, meaning i've hit something.

However, this code is not working very well, as you can tell by my posting here and asking about this function. So, could anyone please provide a clear explanation of the results of trap_Trace so that I can understand exactly how to set the mins,maxs bounding boxes for the trace, as well as interpreting:

My object will hit a wall, the floor, the ceiling, a box, a crate, a ledge, a mover, a player, a vehicle, a you-name-it-something-can-not-move-through-this. *smile*

Jaeden "Sifo Dyas" al'Raec Ruiner

Jaeden "Sifo Dyas" al'Raec Ruiner
JaedenRuiner is offline   you may: quote & reply,