Raised This Month: $ Target: $400
 0% 

entity origin !


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
K.K.Lv
Veteran Member
Join Date: Aug 2008
Location: GameFolder
Old 12-25-2009 , 14:00   entity origin !
Reply With Quote #1

We always set the entity origin used
PHP Code:
pev(idpev_originorigin)
//...
set_pev(entitypev_originorigin
How to set the entity origin in front of player ?

sorry for my bad en ?

just look at the photo
Attached Thumbnails
Click image for larger version

Name:	one.jpg
Views:	507
Size:	11.5 KB
ID:	56038   Click image for larger version

Name:	two.jpg
Views:	453
Size:	19.8 KB
ID:	56041  
__________________
QQ:116268742
K.K.Lv is offline
Send a message via MSN to K.K.Lv
minimiller
Veteran Member
Join Date: Aug 2007
Location: United Kingdom
Old 12-25-2009 , 14:05   Re: entity origin !
Reply With Quote #2

Code:
new Float:flOrigin[3]; pev(id, pev_origin, flOrigin); flOrigin[0] += 50; set_pev(ent, pev_origin, flOrigin);

if that dosent work, try changing "flOrigin[0]" to "flOrigin[1]"
__________________
minimiller is offline
Send a message via MSN to minimiller
K.K.Lv
Veteran Member
Join Date: Aug 2008
Location: GameFolder
Old 12-25-2009 , 14:14   Re: entity origin !
Reply With Quote #3

both dosen't work !
__________________
QQ:116268742
K.K.Lv is offline
Send a message via MSN to K.K.Lv
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 12-25-2009 , 14:15   Re: entity origin !
Reply With Quote #4

- Get the eye position ( pev_origin + pev_view_ofs )
- Get the forward direction ( EngFunc_MakeVectors on the player's view angle ( pev_v_angle ), then using glb_v_forward )
- Then scale the direction by the length yo want and add it the eye position calculated before.
__________________
Arkshine is offline
K.K.Lv
Veteran Member
Join Date: Aug 2008
Location: GameFolder
Old 12-25-2009 , 14:29   Re: entity origin !
Reply With Quote #5

Do you mind give me some example !
__________________
QQ:116268742
K.K.Lv is offline
Send a message via MSN to K.K.Lv
K.K.Lv
Veteran Member
Join Date: Aug 2008
Location: GameFolder
Old 12-25-2009 , 14:34   Re: entity origin !
Reply With Quote #6

PHP Code:
pev(idpev_originorigin)
pev(idpev_view_ofsview)
engfunc(EngFunc_MakeVectorsview)
global_get(glb_v_forward50
like this ?
and I have no idea how to set !
I don't know what func to be called !
__________________
QQ:116268742
K.K.Lv is offline
Send a message via MSN to K.K.Lv
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 12-25-2009 , 14:39   Re: entity origin !
Reply With Quote #7

Code:
#include <amxmodx> #include <fakemeta> enum _:Angle_t { Float:Pitch, Float:Yaw, Float:Roll }; enum _:Coord_t { Float:x, Float:y, Float:z }; #define VectorMA(%0,%1,%2,%3) ( %3[ x ] = %0[ x ] + %1 * %2[ x ], %3[ y ] = %0[ y ] + %1 * %2[ y ], %3[ z ] = %0[ z ] + %1 * %2[ z ] ) Test ( const player ) {     const Float:LENGTH = 150.0;         new Float:origin    [ Coord_t ];     new Float:dirForward[ Coord_t ];     new Float:viewAngles[ Angle_t ];         pev( player, pev_origin, origin );     pev( player, pev_v_angle, viewAngles );         engfunc( EngFunc_MakeVectors, viewAngles );     global_get( glb_v_forward, dirForward );         VectorMA( origin, LENGTH, dirForward, origin );     // origin is now at 150 units in front of player. }
__________________

Last edited by Arkshine; 12-25-2009 at 14:51.
Arkshine is offline
K.K.Lv
Veteran Member
Join Date: Aug 2008
Location: GameFolder
Old 12-25-2009 , 15:23   Re: entity origin !
Reply With Quote #8

Thx ArkShine !
test it and work fine !
__________________
QQ:116268742
K.K.Lv is offline
Send a message via MSN to K.K.Lv
nikhilgupta345
Veteran Member
Join Date: Aug 2009
Location: Virginia
Old 03-20-2011 , 11:03   Re: entity origin !
Reply With Quote #9

Sorry for bringing back an old topic, but I was wondering when would be the best time to use this if I am trying to keep the entity constantly in front of the player. Would it be best used in PreThink?
__________________
Quote:
Originally Posted by DarkGod View Post
nikhilgupta generates his plugins using sheer awesome.
If you like my work, please
nikhilgupta345 is offline
Send a message via ICQ to nikhilgupta345 Send a message via Yahoo to nikhilgupta345
Reply


Thread Tools
Display Modes

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 04:12.


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