AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [SOLVED] Get player's 'hands' origin (https://forums.alliedmods.net/showthread.php?t=74444)

danielkza 07-18-2008 22:20

[SOLVED] Get player's 'hands' origin
 
Hi, I need to get the player's 'hands' origin (or, if you want,get the origin of a player model's attachment). I know the engine does it, as messages like TE_BEAMFOLLOW accept and entid ORed with an attachment bitflag. Does anybody know how to do this?

Thanks in advance.

danielkza 07-18-2008 22:56

Re: Get player's 'hands' origin
 
Nevermind,I found a better way: instead of getting their hand pos,I just use angle_vector() to get a normalized vector pointing to where they are looking at, and add it to the user's origin. The code:
Code:

if(++iPlayerJump_Thinks[id] >= 10)
{
    static Float:fOrigin[3]
    pev(id,pev_origin,fOrigin)
   
    static Float:fAngles[3],Float:fAngleVector[3]

    pev(id,pev_angles,fAngles)
    angle_vector(fAngles,1,fAngleVector)

    for(new i=0;i <3;i++)
        fOrigin[i] += (fAngleVector[i] * 20)
   
    BeamPointPoint(fPlayerJump_BeamPos[id],fOrigin,iBeamSprite)
   
    fPlayerJump_BeamPos[id] = fOrigin
}



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

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