Raised This Month: $ Target: $400
 0% 

Set origin behind of the enemy?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
xLeoNNN
Veteran Member
Join Date: Sep 2010
Location: de_dust2
Old 11-14-2010 , 13:22   Set origin behind of the enemy?
Reply With Quote #1

Hello!, someone knows since I can do, that on having written / something, the player's transport, but behind the enemy?
that put the origin behind the enemy. Please!
__________________
xLeoNNN is offline
Send a message via MSN to xLeoNNN
Hunter-Digital
Veteran Member
Join Date: Aug 2006
Location: In the Game [ro]
Old 11-14-2010 , 13:38   Re: Set origin behind of the enemy?
Reply With Quote #2

It's simple, you get the player's origin, his forward direction and add the origin to the negatively multiplied forward direction by how many units you want it behind the player's origin.

Quick code, 100 units behind the player's VIEW (if player looks down, the origin will be up, if he looks streight ahead, the origin will be behind him)
Code:
new Float:fOrigin[3]
new Float:fAngles[3]
new Float:fForward[3]

entity_get_vector(id, EV_VEC_origin, fOrigin)
entity_get_vector(id, EV_VEC_v_angle, fAngles)

angle_vector(fAngles, ANGLEVECTOR_FORWARD, fForward) 

fOrigin[0] += -fForward[0] * 100
fOrigin[1] += -fForward[1] * 100
fOrigin[2] += -fForward[2] * 100 /* remove this if you don't want it to affect the origin if player looks up or down */

/* fOrigin contains player's behind view origin */
__________________
Hunter-Digital is offline
xLeoNNN
Veteran Member
Join Date: Sep 2010
Location: de_dust2
Old 11-14-2010 , 15:00   Re: Set origin behind of the enemy?
Reply With Quote #3

Try with it, the increase, this diminishes the fOrigin and fForward, but it did not put me origin :/
__________________
xLeoNNN is offline
Send a message via MSN to xLeoNNN
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 11-14-2010 , 15:18   Re: Set origin behind of the enemy?
Reply With Quote #4

Quote:
Originally Posted by xLeoNNN View Post
Try with it, the increase, this diminishes the fOrigin and fForward, but it did not put me origin :/
You have to complete the code yourself. He just posted code to find the origin.
__________________
fysiks 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 11:14.


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