Raised This Month: $ Target: $400
 0% 

Get weapon bullet start origin where that Muzzleflash sprite appear


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
.Dare Devil.
Veteran Member
Join Date: Sep 2010
Old 05-19-2014 , 20:10   Get weapon bullet start origin where that Muzzleflash sprite appear
Reply With Quote #1

Hello everyone!

As the tittle says ... i want to create some new shooting effects but in order to do that i need to know
how to do that what tittle says

Well here is image:


Part of me remembers that it was somehow possible yet i cant remember how and i dont know how to search it because i dont know what is the name of that thing i want.

Thanks!

Last edited by .Dare Devil.; 05-20-2014 at 14:25.
.Dare Devil. is offline
DavidJr
Senior Member
Join Date: Apr 2012
Old 05-20-2014 , 19:55   Re: Get weapon bullet start origin where that Muzzleflash sprite appear
Reply With Quote #2

I use this for tracer:

PHP Code:
public fwd_TraceAttack_Post(iVictimiAttackerFloat:flDamageFloat:fDir[3], ptriDamageType)
{
    new 
iWeapon get_user_weapon(iAttacker);
    
    if (
iWeapon == CSW_KNIFE) return;

    new 
Float:flOrigin[3], Float:flEnd[3];

    
GetWeaponAttachment(iAttackerflOrigin);
    
get_tr2(ptrTR_vecEndPosflEnd);
    
    
message_begin(MSG_BROADCASTSVC_TEMPENTITY);
    
write_byte(TE_TRACER);
    
write_coord(floatround(flOrigin[0]));
    
write_coord(floatround(flOrigin[1]));
    
write_coord(floatround(flOrigin[2]));
    
write_coord_f(flEnd[0]);
    
write_coord_f(flEnd[1]);
    
write_coord_f(flEnd[2]);
    
message_end();
}

GetWeaponAttachment(iIndexFloat:flOutput[3], Float:fDist 40.0)

    new 
Float:flEnd[3], iEnd[3];
    
get_user_origin(iIndexiEnd3);
    
IVecFVec(iEndflEnd);
    
    new 
Float:flOrigin[3];
    
pev(iIndexpev_originflOrigin);
    
    new 
Float:flAngles[3];
    
pev(iIndexpev_view_ofsflAngles);
    
    
xs_vec_add(flOriginflAnglesflOrigin
    
    new 
Float:flAttack[3];
    
xs_vec_sub(flEndflOriginflAttack);
    
xs_vec_sub(flEndflOriginflAttack);
    
    new 
Float:flRate fDist vector_length(flAttack);
    
    
xs_vec_mul_scalar(flAttackflRateflAttack);
    
xs_vec_add(flOriginflAttackflOutput);

By the way, is it CS 1.6? How do you show the location under radar?
__________________
What are you looking for here?

Last edited by DavidJr; 05-20-2014 at 19:57.
DavidJr is offline
.Dare Devil.
Veteran Member
Join Date: Sep 2010
Old 05-20-2014 , 23:32   Re: Get weapon bullet start origin where that Muzzleflash sprite appear
Reply With Quote #3

that code wont work for the model in image.
Also it is not cs1.6, it is css
.Dare Devil. is offline
DavidJr
Senior Member
Join Date: Apr 2012
Old 05-21-2014 , 00:32   Re: Get weapon bullet start origin where that Muzzleflash sprite appear
Reply With Quote #4

Quote:
Originally Posted by .Dare Devil. View Post
that code wont work for the model in image.
Muzzleflash starts to show from the attachment, I just showed it to you.

Quote:
Originally Posted by .Dare Devil. View Post
Also it is not cs1.6, it is css
Okay, I believe you.

Spoiler
__________________
What are you looking for here?
DavidJr is offline
meTaLiCroSS
Gaze Upon My Hat
Join Date: Feb 2009
Location: Viņa del Mar, Chile
Old 05-21-2014 , 02:51   Re: Get weapon bullet start origin where that Muzzleflash sprite appear
Reply With Quote #5

That's something that can be half-done. To get the exact position of it's attachments, it is not possible that easy. You can get an entity's attachment with engfunc(EngFunc_GetAttachment, ...) providing the right params.

There's something that you can try, but it is just an idea, because there are some math calculations involucrated.

You can create a entity on precache, set it's model and angles to 0.0-0.0-0.0, set it's model to the weapon's v_ model (yeah, v_ model) and use the function related to get it's attachments. Then, you will have the origin of the attachment and the angle to the attachment starting from the middle of the model.

Don't know if this math guess will work, but "try" to use angle_vector(...) with the angle gotten, and scale the vector result by the len of the origin gotten. Add the scaled vector to your eye position, and try an effect to see if that was accurate.
__________________
Quote:
Originally Posted by joropito View Post
You're right Metalicross
meTaLiCroSS is offline
NiHiLaNTh
Way Past Expiration
Join Date: May 2009
Location: Latvia
Old 05-21-2014 , 03:45   Re: Get weapon bullet start origin where that Muzzleflash sprite appear
Reply With Quote #6

try searching on russian forums. Somebody has posted something similar years ago
__________________

NiHiLaNTh is offline
Send a message via Skype™ to NiHiLaNTh
.Dare Devil.
Veteran Member
Join Date: Sep 2010
Old 05-21-2014 , 10:17   Re: Get weapon bullet start origin where that Muzzleflash sprite appear
Reply With Quote #7

It is not hard to get the origin where muzzleflash appear, the problem is where it gonna appear.
This weapon have 2 muzzleflash origin and detecting which one will appear when i shoot is hard.
I guess this is impossible and i should trash my idea.
.Dare Devil. is offline
DavidJr
Senior Member
Join Date: Apr 2012
Old 05-21-2014 , 10:23   Re: Get weapon bullet start origin where that Muzzleflash sprite appear
Reply With Quote #8

I guess it depends on the CSW_*
__________________
What are you looking for here?
DavidJr is offline
meTaLiCroSS
Gaze Upon My Hat
Join Date: Feb 2009
Location: Viņa del Mar, Chile
Old 05-21-2014 , 16:41   Re: Get weapon bullet start origin where that Muzzleflash sprite appear
Reply With Quote #9

It's a model handled by the client, and anyway, you can try to guess a point by doing some random tests, but having the exact attachment position seems to be not possible.

I'm going to test what I said and going to tell you what happens.
__________________
Quote:
Originally Posted by joropito View Post
You're right Metalicross
meTaLiCroSS is offline
WildCard65
Veteran Member
Join Date: Aug 2013
Location: Canada
Old 05-21-2014 , 17:23   Re: Get weapon bullet start origin where that Muzzleflash sprite appear
Reply With Quote #10

Quote:
Originally Posted by .Dare Devil. View Post
that code wont work for the model in image.
Also it is not cs1.6, it is css
you want it for css or for cs 1.6?
WildCard65 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 09:38.


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