Raised This Month: $ Target: $400
 0% 

Getting origin in front of player


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Twilight Suzuka
bad
Join Date: Jul 2004
Location: CS lab
Old 04-13-2005 , 21:19  
Reply With Quote #2

Try this:

Code:
public get_oriented_origin(id,Float:fDistance)
{
	new Float:nOrigin[3]
	new Float:vAngles[3] // plug in the view angles of the entity
	new Float:vReturn[3] // to get out an origin fDistance away


	entity_get_vector(id,EV_VEC_origin,nOrigin)
	entity_get_vector(id,EV_VEC_v_angles,vAngles)
	
	vReturn[0] = floatcos( vAngles[1], degrees ) * fDistance
	vReturn[1] = floatsin( vAngles[1], degrees ) * fDistance
	vReturn[2] = floatsin( -vAngles[0], degrees ) * fDistance 

	vReturn[0] =+ nOrigin[0]
	vReturn[1] =+ nOrigin[1]
	vReturn[2] =+ nOrigin[2]

	return 1;
}
It may or may not work. First, it gets the angles and gets the vector direction they are looking in, multiplies it to get a specific distance, and then adds it to their origin.

Give it a shot.
__________________
Twilight Suzuka is offline
Send a message via AIM to Twilight Suzuka Send a message via MSN to Twilight Suzuka
 



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 09:49.


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