SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Filterscripts > Includes

Reply
 
Thread Tools Display Modes
Old 14/08/2011, 12:53 AM   #1
Nero_3D
High-roller
 
Nero_3D's Avatar
 
Join Date: Jun 2007
Location: Germany
Posts: 3,756
Reputation: 643
Default GetPlayerCameraWeaponVector

GetPlayerCameraWeaponVector

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

Parameters
Code:
(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

__________________

Last edited by Nero_3D; 02/01/2016 at 02:51 AM.
Nero_3D is offline   Reply With Quote
Old 14/08/2011, 12:54 AM   #2
RyDeR`
High-roller
 
RyDeR`'s Avatar
 
Join Date: Feb 2009
Location: Belgium
Posts: 3,064
Reputation: 693
Default Re: GetPlayerCameraWeaponVector

Awesome! Thanks for sharing this useful include Nero.

+ rep.
__________________

Sup?
RyDeR` is offline   Reply With Quote
Old 14/08/2011, 01:20 AM   #3
[Ask]Terminator
Huge Clucker
 
[Ask]Terminator's Avatar
 
Join Date: Jan 2009
Posts: 198
Reputation: 3
Default Re : GetPlayerCameraWeaponVector

realy nice release
__________________
Code:
[Ask]Terminator is offline   Reply With Quote
Old 14/08/2011, 01:47 AM   #4
Whitetiger
Huge Clucker
 
Whitetiger's Avatar
 
Join Date: Nov 2007
Location: Greenville, NC, USA
Posts: 469
Reputation: 139
Default Re: GetPlayerCameraWeaponVector

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

Author of SA-MP AC

Whitetiger is offline   Reply With Quote
Old 14/08/2011, 01:58 AM   #5
Kar
High-roller
 
Kar's Avatar
 
Join Date: May 2010
Location: Black Asylum
Posts: 3,205
Reputation: 497
Default Re: GetPlayerCameraWeaponVector

Quote:
Originally Posted by whitetigerswt View Post
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
Kar is online now   Reply With Quote
Old 14/08/2011, 02:36 AM   #6
Lorenc_
High-roller
 
Lorenc_'s Avatar
 
Join Date: Jan 2010
Location: Australia
Posts: 4,270
Reputation: 1129
Default Re: GetPlayerCameraWeaponVector

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

rep + from me!
__________________
Join the best Cops And Robbers in SA-MP, today. svr.irresistiblegaming.com:7777

Lorenc_ is offline   Reply With Quote
Old 14/08/2011, 02:40 AM   #7
Scenario
Godfather
 
Scenario's Avatar
 
Join Date: Feb 2010
Location: Heaven
Posts: 8,133
Reputation: 701
Default Re: GetPlayerCameraWeaponVector

Oh this will be very nice and useful!

+ rep
Scenario is offline   Reply With Quote
Old 14/08/2011, 02:43 AM   #8
MiTToS
Huge Clucker
 
MiTToS's Avatar
 
Join Date: Jul 2011
Posts: 290
Reputation: 35
Default Re: GetPlayerCameraWeaponVector

Awesome! I liked it.
MiTToS is offline   Reply With Quote
Old 09/09/2011, 07:46 PM   #9
Darnell
Gangsta
 
Darnell's Avatar
 
Join Date: Jul 2010
Posts: 853
Reputation: 34
Default Re: GetPlayerCameraWeaponVector

I like it.
Darnell is offline   Reply With Quote
Old 09/09/2011, 08:16 PM   #10
Trooper[Y]
Gangsta
 
Trooper[Y]'s Avatar
 
Join Date: Apr 2009
Posts: 514
Reputation: 18
Default AW: GetPlayerCameraWeaponVector

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!
__________________




Trooper[Y] is offline   Reply With Quote
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



All times are GMT. The time now is 03:23 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.