Posts: 400
Threads: 69
Joined: Apr 2009
Reputation:
0
Hey there.
I need your help.
I found some snippets with the function "IsPlayerAimingAt",
but that doesnt helps me in any way.
So, i want to get the coordinates to the position, where the player is aiming to.
I think i saw something like that before, where pickups had been created in front of the player to show the line of sight with a weapon.
Waiting for you answer,
Trooper
Posts: 400
Threads: 69
Joined: Apr 2009
Reputation:
0
Got this snippet from a fs:
[code]
new Float:gtpos[50];
GetPlayerCameraPos(playerid,gtpos[0],gtpos[1],gtpos[2]);
GetPlayerCameraFrontVector(playerid,gtpos[3],gtpos[4],gtpos[5]);
for(new checkdist=0;checkdist<=50;checkdist+=10)
{
marker[playerid][checkdist] = CreatePickup(1239,23,gtpos[3]*checkdist+gtpos[0],gtpos[4]*checkdist+gtpos[1],gtpos[5]*checkdist+gtpos[2]);
}
[code]
The problem is, that its not exact, sometimes lowers, even i aimed upwards, or is too low.
replace "or" with "and"...
Posts: 3,304
Threads: 58
Joined: Sep 2008
Reputation:
0
Can you show me your IsPlayerAimingAt function? The solution is in that command.
Posts: 400
Threads: 69
Joined: Apr 2009
Reputation:
0
Thats the problem.
Without aiming my other way also works.
But if i aim, its getting wrong...
Posts: 4,878
Threads: 85
Joined: Jun 2007
Reputation:
0
When aiming with weapon, there is a offset to the FrontVector, because the camera zooms in and the player is moved a bit to the left of the screen. You can minimize the offset by adding/subtracting a specific angle to the rotation and z-angle of the FrontVector (calc the angles from the vector first with atan). Hard to explain, youll have to experiment a bit with the angles, dont know if someone else beside me did this yet.
Ive got a precise include for this, but sorry, i wont release it as long as i am working on a gm that uses it.