AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Get Player Shot angle (https://forums.alliedmods.net/showthread.php?t=216195)

Phant 05-17-2013 18:47

Get Player Shot angle
 
Hello. I can get player view angle (the result will be two numbers):
Code:

pev(id, pev_v_angle, v_angle)
Can I get player shot angle like that?
I think vector_to_angle() function can be useful.

http://s22.************/bko135gwx/de_nuke0045.jpg

Thanks for advice & sorry for my bad English.

pokemonmaster 05-17-2013 18:49

Re: Get Player Shot angle
 
you mean the rotation of the player model?

Phant 05-17-2013 19:05

Re: Get Player Shot angle
 
Quote:

Originally Posted by pokemonmaster (Post 1953671)
you mean the rotation of the player model?

No. I mean angle of "bullet shot" (TraceLine) by Player.
Another screenshot example:
http://3.firepic.org/3/images/2013-0...r15qzg8x5l.jpg

.Dare Devil. 05-17-2013 21:09

Re: Get Player Shot angle
 
Its strange that you guys always show things in picture with 2d( 2 coords numbers.)
This is 3D game so obvious there is more than just 2 float values. ( x, y, z )

Phant 05-18-2013 08:03

Re: Get Player Shot angle
 
Quote:

Originally Posted by .Dare Devil. (Post 1953699)
Its strange that you guys always show things in picture with 2d( 2 coords numbers.)
This is 3D game so obvious there is more than just 2 float values. ( x, y, z )

But, angle is two numbers, like pev_v_angle or pev_punchangle. Or like BSP Viewer, try Edit / Copy Camera Angles, you got two float numbers.
I want get angle of each weapon shot TraceLine (from player eyes position). I think this is correct and possible, but how :)?

hornet 05-18-2013 11:19

Re: Get Player Shot angle
 
Quote:

Originally Posted by Phant (Post 1953867)
But, angle is two numbers, like pev_v_angle or pev_punchangle. Or like BSP Viewer, try Edit / Copy Camera Angles, you got two float numbers.
I want get angle of each weapon shot TraceLine (from player eyes position). I think this is correct and possible, but how :)?

What are you trying do?
And also no, it's pitch, yaw, and roll for angles.

ConnorMcLeod 05-18-2013 16:27

Re: Get Player Shot angle
 
You should do this :
PHP Code:

{
    new 
Float:aim_vec[3];
    
pev(idpev_v_angleaim_vec);
    
engfunc(EngFunc_MakeVectorsaim_vec);
    
global_get(glb_v_forwardaim_vec);


You can trick it doing that (same thing is done internally to amxx):
PHP Code:

{
    new 
Float:aim_vec[3];
    
velocity_by_aim(id1aim_vec);


And if it is for traceline, to velocity_by_aim(id, 9999, aim_vec); so you can use player gun origin for trace start, and add aim_vec to start to set end position.

Phant 10-14-2013 06:08

Re: Get Player Shot angle
 
I want get player shot angle (traceline?), not aim/pevs, etc.
I try use (for visualisation):
Code:

register_forward(FM_TraceLine, "traceline_forward")
With:
Code:

public traceline_forward(Float:start[3], Float:end[3], conditions, id, trace)
{
    if(trace != 1241012)
    {
        client_print(0, print_chat, "%f %f %f / %f %f %f", start[0], start[1], start[2], end[0], end[1], end[2])
        new Float:k_origin[3]
        get_user_origin(id,k_origin)
        message_begin(MSG_ONE, SVC_TEMPENTITY,{0,0,0}, id)
        write_byte( TE_BEAMPOINTS )
        write_coord(k_origin[0])
        write_coord(k_origin[1])
        write_coord(k_origin[2])
        write_coord(end[0])
        write_coord(end[1])
        write_coord(end[2])
        write_short( m_spriteTexture )
        write_byte( 1 ) // framestart
        write_byte( 1 ) // framerate
        write_byte( 100 ) // life in 0.1's
        write_byte( 5 ) // width
        write_byte( 0 )  // noise
        write_byte( 0 )  // r, g, b
        write_byte( 0 )  // r, g, b
        write_byte( 255 )  // r, g, b
        write_byte( 255 )  // brightness
        write_byte( 0 )    // speed
        message_end()
    }
}

But it's wrong:
http://2.firepic.org/2/thumbs/2013-1...5s03wtcjei.jpghttp://2.firepic.org/2/thumbs/2013-1...dnw9tfub2m.jpg

hornet 10-14-2013 06:25

Re: Get Player Shot angle
 
Because FM_TraceLine gives you Float vectors not integer vectors. write_coord() is for integer vectors. You need to use EngFunc_WriteCoord .

Phant 10-14-2013 06:41

Re: Get Player Shot angle
 
Quote:

Originally Posted by hornet (Post 2048696)
Because FM_TraceLine gives you Float vectors not integer vectors. write_coord() is for integer vectors. You need to use EngFunc_WriteCoord .

Thanks, its works now.

Back to topic. Who can help with getting weapon shot angle (2 Float values)?


All times are GMT -4. The time now is 16:18.

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