[SNIPPET] Get aiming positionaim

Hi,
I just made/edited a little script to get the aiming position of the crosshair.

Use GOSUB @GET_AIMING_POS to get the aiming cordinates.
It will store the cordinates to 0@ 1@ 2[member=34438].[/member]

Heres an example wich creates a explosion at the aiming position if you rightclick:
Code:
{$CLEO .cs}
THREAD "AIM_EXPLOSION"
0662: NOP "www.youtube.com/OpcodeXe" 
0662: NOP "www.ugbase.eu" 

:START
wait 10
if
0AB0: KEY_PRESSING: 2 // RIGHT MOUSE BUTTON - AIMING
jf @START
GOSUB @GET_AIMING_POS // RETURNS AIMING AT POSITION TO: 0@ 1@ 2@
020C: create_explosion_with_radius 3 at 0@ 1@ 2@ 
Jump @START




:GET_AIMING_POS // PASTE THIS AT THE END OF THE SCRIPT
Actor.StorePos($PLAYER_ACTOR, 1@, 2@, 3@)
0A9F: 5@ = current_thread_pointer 
5@ += 80 
0A8E: 6@ = 5@ + 12 // int 
0AA6: call_method 5327216 11989032 num_params 6 pop 0 6@ 5@ 3@ 2@ 1@ 4@  
if 
86BD:   not no_obstacles_between 1@ 2@ 3@ and 8@ 9@ 10@ solid 1 car 1 actor 0 object 1 particle 0 
else_jump @ADD 
jump @END_POS 

:ADD
4@ += 1.0 
if
  4@ > 250.0 
else_jump @GET_AIMING_POS 

:END_POS
0@ = 0.0
1@ = 0.0
2@ = 0.0
005B: 0@ += 8@ // (float) 
005B: 1@ += 9@ // (float) 
005B: 2@ += 10@ // (float)
4@ = 0.0 // RESET THE AIM RADIUS  
return

VIDEO EXAMPLE:
[youtube:v8z3k5za]http://www.youtube.com/watch?v=AZoiY6k760g[/youtube:v8z3k5za]
 

blackHat

Expert
Joined
Jul 28, 2013
Messages
930
Reaction score
2
Re: Get aiming position

springfield link said:
Not with this function, you could maybe with math but not very accurate calculate where the other player is pointing his gun.


:ugbase:


hmmm ok
 

Grubitsh

Active member
Joined
Jul 28, 2014
Messages
104
Reaction score
0
Re: Get aiming position

Double post sorry.

Well, I used your script for a camera. In fact, it's in free camera mod, then, by pressing a button, It call your function to get the actual "camera pointing at", and finally, It forces the camera to stay pointing at this position (the position your function returns by 0 1 2).

It works, but i don't know why, I got a little shift in the position.

Look at this video, I aim the haystack but it target a little more up to the haystack.

I also putted a marker on the position your function is returning.

Should I go with this ?
http://ugbase.eu/snippets/create_cords_around_player_in_looking_direction-w-offset/msg35405/#msg35405

or this ?
http://ugbase.eu/snippets/convert-3d-position-to-2d-screencords/

Do you have any solution please ?

Sorry for bad english, thanks

 

Opcode.eXe

Expert
Joined
Feb 18, 2013
Messages
1,486
Reaction score
227
Location
( ͡° ͜ʖ ͡°)
Re: Get aiming position

Grubitsh link said:
Double post sorry.

Well, I used your script for a camera. In fact, it's in free camera mod, then, by pressing a button, It call your function to get the actual "camera pointing at", and finally, It forces the camera to stay pointing at this position (the position your function returns by 0 1 2).

It works, but i don't know why, I got a little shift in the position.

Look at this video, I aim the haystack but it target a little more up to the haystack.

I also putted a marker on the position your function is returning.

Should I go with this ?
http://ugbase.eu/snippets/create_cords_around_player_in_looking_direction-w-offset/msg35405/#msg35405

or this ?
http://ugbase.eu/snippets/convert-3d-position-to-2d-screencords/

Do you have any solution please ?

Sorry for bad english, thanks



This snippet gets the AIMING pos:
Try to aim with a deagle, u will see that it will get the exact cordinates where you're aiming at.
Your helicopter crosshair is in the middle of the screen, so offsets are like +10
 

Zin

Expert
Joined
Aug 1, 2013
Messages
1,693
Reaction score
105
Re: Get aiming position

Sorry to bump  this but how can you get the aiming position while in driveby mode
 
Top