Raised This Month: $51 Target: $400
 12% 

Spawning Entities


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
otstrel
SourceMod Donor
Join Date: Aug 2004
Old 11-05-2008 , 07:12   Spawning Entities
Reply With Quote #1

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.
__________________
don't shoot the lamer, he's doing the best he can
otstrel is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 13:13.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode