I'm writing a plugin which allows player to buy items for kill points. Items are spawned where crosshair points to.
I use TR_TraceRay to get that point coordinates and I have two major problems.
Code:
decl Float:start[3], Float:angle[3], Float:end[3], Float:normal[3];
GetClientEyePosition( client, start );
GetClientEyeAngles( client, angle );
TR_TraceRay(start, angle, CONTENTS_SOLID|CONTENTS_OPAQUE, RayType_Infinite);
First problem - despite number of flags I tried in TR_TraceRay it ignores already spawned items, i.e. if I point to the wall and spawn two items one after another, second item gets spawned between first item and wall, not in front of first item.
Second problem - when I spawn item at the point I get with TR_GetEndPosition call it sometimes gets stuck in the floor. I have a feeling that I need to use TR_TraceHull instead of TR_TraceRay but I cannot see how I can get entity model size to pass into this call and I don't like hard-coding sizes for specific models....
Any ideas are very welcome.
__________________