SA-MP Forums Archive
[Include] GetPlayerCameraWeaponVector - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Filterscripts (https://sampforum.blast.hk/forumdisplay.php?fid=17)
+---- Forum: Includes (https://sampforum.blast.hk/forumdisplay.php?fid=83)
+---- Thread: [Include] GetPlayerCameraWeaponVector (/showthread.php?tid=276490)

Pages: 1 2


GetPlayerCameraWeaponVector - Nero_3D - 14.08.2011

GetPlayerCameraWeaponVector

As the title says, here I am providing a function which gets roughly the vector if you aim with a ranged weapon

Parameters
Код:
(playerid, & Float: vX, & Float: vY, & Float: vZ)

playerid	The ID of the player you want to obtain the camera weapon vector of.
Float: vX	A float to store the X coordinate, passed by reference.
Float: vY	A float to store the Y coordinate, passed by reference.
Float: vZ	A float to store the Z coordinate, passed by reference.

Returns false if there wasn't a ranged weapon equipped or the player isn't connected
This include only contain one function, you are free to copy / paste it

Download

GitHub v5
GitHub v3

Changelog v5

The major change is that I changed the code from a constant (~accurate with +-5 degrees) to a function

I know everyone likes images therefore I present the interpolation (---) for the measurement (points), y = zRot-Offset, x = Z-Vector
Well this could have been more accurate but I wanted to use a simple polynomial (y = a*(x-b)^c + d)
Anyway should be somehow accurate if you don't aim to low < -35 degrees




Re: GetPlayerCameraWeaponVector - RyDeR` - 14.08.2011

Awesome! Thanks for sharing this useful include Nero.

+ rep.


Re : GetPlayerCameraWeaponVector - [Ask]Terminator - 14.08.2011

realy nice release


Re: GetPlayerCameraWeaponVector - Whitetiger - 14.08.2011

these aren't the correct offsets, you get the correct ones from going into weapon.dat..


Re: GetPlayerCameraWeaponVector - Kar - 14.08.2011

Quote:
Originally Posted by whitetigerswt
Посмотреть сообщение
these aren't the correct offsets, you get the correct ones from going into weapon.dat..
These are the offsets that work with sa-mp


Re: GetPlayerCameraWeaponVector - Lorenc_ - 14.08.2011

This will come in so damn handy for me, thanks alot nero!

rep + from me!


Re: GetPlayerCameraWeaponVector - Scenario - 14.08.2011

Oh this will be very nice and useful!

+ rep


Re: GetPlayerCameraWeaponVector - MiTToS - 14.08.2011

Awesome! I liked it.


Re: GetPlayerCameraWeaponVector - Darnell - 09.09.2011

I like it.


AW: GetPlayerCameraWeaponVector - Trooper[Y] - 09.09.2011

Was waiting for my doctor title to do that,
but now you did it, we can finally advance with camera functions.

Thanks a lot,
very helpful!


Re: GetPlayerCameraWeaponVector - Alureon - 09.09.2011

Thanks i was waiting, for something like this.


Re: GetPlayerCameraWeaponVector - Niko_boy - 12.09.2011

coool dude
and very usefull


Re: GetPlayerCameraWeaponVector - ғαιιοцт - 27.12.2011

It's really handy! Nice work


Re: GetPlayerCameraWeaponVector - newbie scripter - 08.12.2013

What Does It Do?? does it get the pos where the player is aiming?


AW: Re: GetPlayerCameraWeaponVector - Nero_3D - 08.12.2013

Quote:
Originally Posted by newbie scripter
View Post
What Does It Do?? does it get the pos where the player is aiming?
Yes it gets first the front vector (thats always the center of the screen) and adjust it to the crosshair of the weapon, also the aiming vector


Re: GetPlayerCameraWeaponVector - iJumbo - 08.12.2013

Awesome


Re: AW: Re: GetPlayerCameraWeaponVector - newbie scripter - 12.12.2013

Quote:
Originally Posted by Nero_3D
View Post
Yes it gets first the front vector (thats always the center of the screen) and adjust it to the crosshair of the weapon, also the aiming vector
then my idea can become true


Re: AW: Re: GetPlayerCameraWeaponVector - Ballu Miaa - 05.01.2014

Quote:
Originally Posted by Nero_3D
View Post
Yes it gets first the front vector (thats always the center of the screen) and adjust it to the crosshair of the weapon, also the aiming vector
Crazy i always needed something like this to make a shooting range i think. Great work. Rep+4


Re: GetPlayerCameraWeaponVector - Voxel - 05.01.2014

Nice I was looking for this


Re: GetPlayerCameraWeaponVector - iZN - 05.01.2014

This looks good! It might get handy.