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

Solved How to get model attachment origin on a specific frame?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Natsheh
Veteran Member
Join Date: Sep 2012
Old 07-13-2022 , 05:34   How to get model attachment origin on a specific frame?
Reply With Quote #1

I don't know if its possible to achieve this, but as far as i know EngFunc_GetAttachment only gets the origin and angles for the attachment on the first frame.
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !


Last edited by Natsheh; 07-15-2022 at 19:56.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 07-13-2022 , 18:22   Re: How to get model attachment origin on a specific frame?
Reply With Quote #2

Looking at EngFunc_GetAttachment code, I believe it takes pev_frame into account. So if you want to get the attachment position on a frame other than what the entity's current frame is, just set pev_frame temporarily then revert it I guess.
__________________
klippy is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 07-14-2022 , 05:49   Re: How to get model attachment origin on a specific frame?
Reply With Quote #3

it Works, but i found something strange rgflAngles in GetAttachment as well as in GetBonePosition is not retrieved, why so ?

and also the origin of attachment is always retrieved with respect to the angles 0.0 0.0 0.0.
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
Natsheh
Veteran Member
Join Date: Sep 2012
Old 07-15-2022 , 05:34   Re: How to get model attachment origin on a specific frame?
Reply With Quote #4

Solution:

PHP Code:
pev(entpev_framefPrevFrame);
pev(entpev_animetimefAnimTime);
set_pev(entpev_frame, (get_gametime() - fAnimTime) * AnimationFPS)

engfunc(EngFunc_GetAttachmententattachmentIDfOriginfAngles);
set_pev(entpev_framefPrevFrame
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !


Last edited by Natsheh; 07-15-2022 at 05:36.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
Natsheh
Veteran Member
Join Date: Sep 2012
Old 07-15-2022 , 19:55   Re: How to get model attachment origin on a specific frame?
Reply With Quote #5

Quote:
Originally Posted by Natsheh View Post
it Works, but i found something strange rgflAngles in GetAttachment as well as in GetBonePosition is not retrieved, why so ?

and also the origin of attachment is always retrieved with respect to the angles 0.0 0.0 0.0.
Work around solution....

PHP Code:
GetAttachmentData(const id, const iAttachmentIDFloat:fRetOrigin[3], Float:fRetAngles[3])
{
    static 
Float:fStart[3], Float:fVAngles[3], Float:fOrigin[3], Float:fVec[3], Float:fHeight;
    
engfunc(EngFunc_GetAttachmentidiAttachmentIDfStartfVAngles);

    
pev(idpev_originfOrigin);
    
pev(idpev_anglesfVAngles);
    
fHeight fOrigin[2] = fStart[2];
    
xs_vec_sub(fStartfOriginfStart);

    
xs_vec_copy(fStartfVec);
    
fStart[0] = ((fVec[0] * floatcos(fVAngles[1],degrees)) - fVec[1] * floatsin(fVAngles[1],degrees)) + fOrigin[0];
    
fStart[1] = ((fVec[0] * floatsin(fVAngles[1],degrees)) + fVec[1] * floatcos(fVAngles[1],degrees)) + fOrigin[1];
    
fStart[2] = fHeight;

    
xs_vec_copy(fStartfRetOrigin);
    
xs_vec_copy(fVAnglesfRetAngles);

__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
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 18:06.


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