Home   Help Search Login Register  

Author Topic: Where you are pointing at? part 2  (Read 2211 times)

0 Members and 1 Guest are viewing this topic.

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Where you are pointing at? part 2
« on: 27 May 2006, 12:28:18 »
This was an old post without apparent solution.
With getDir you get your heading, but you dont know where your weapon is really pointing at (some degrees left from your heading, a bit low, etc). Firing a bullet and catching its velocity vector was not an option (you should not fire any round).

Now I have a possible solution based on two drop commands and selection names.
A drop command for soldier righthand selection name using righthandgetpos.sqs as the script for particle end of life and a life of 0.2 seconds for the particle.
And a drop command for soldier weapon selection name using weapongetpos.sqs as the script for particle end of life and a life of 0.2 seconds for the particle.
These scripts should get the [x,y,z] pos of respective particles in "this" after 0.2 seconds, so the angles between righthand and weapon would be quite easy to calculate.

But whatever selection name I use, the particles always summon near the feet of the soldier.

Code: [Select]
_soldier  = _this select 0
drop ["cl_basic", "", "Billboard", 1, 0.2, "pruka", [0,0,0], 0,25.50,20,0, [0.1], [[1,1,1,1]], [0], 0, 0, "", "righthandgetpos.sqs", _soldier]
drop ["cl_basic", "", "Billboard", 1, 0.2, "zbran", [0,0,0], 0,25.50,20,0, [0.1], [[1,1,1,1]], [0], 0, 0, "", "weapongetpos.sqs", _soldier]

Am I missing the correct selection names or something?

Got the selection names from here:
Lowlands warrior soldier model selection reference

Offline uiox

  • Contributing Member
  • **
Re: Where you are pointing at? part 2
« Reply #1 on: 27 May 2006, 13:00:17 »
use this script in the fired event :

Fired= "[ _This select 0, _this select 1,_this select 2,_this select 3,_this select 4,velocity(nearestObject [_this select 0 , _this select 4 ]), getpos (nearestObject [_this select 0 , _this select 4 ]),getDir (nearestObject [_this select 0 , _this select 4 ])] exec {thescript.sqs} "
         
the script sqs:

_Vel = _This select 5

_x = _Vel select 0
_y =_Vel select 1
_z = _Vel select 2
_x2 = _x * _x
_y2 = _y * _y
_z2 = _z * _z
_Rac = sqrt (_x2 + _y2 +_z2)
_Rac2d = sqrt (_x2 + _y2 )
_AngleShot =     acos  ( (( _x2 * 2)+( _y2 * 2))/ (2 * (_Rac * _Rac2d )) )

I make calculation directly in the event for avoid OFP do not "catch" the value with hight speed bullet gun.



Cool OFPEC is back... :)

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Where you are pointing at? part 2
« Reply #2 on: 27 May 2006, 13:09:17 »
Thanks Uiox, but, as indicated, firing is not an option, the unit should not fire, just aim. If the unit fires, the enemies nearby may detect your unit.

Offline uiox

  • Contributing Member
  • **
Re: Where you are pointing at? part 2
« Reply #3 on: 27 May 2006, 13:21:30 »
Without fire, 4 me no solution to this problem, problems with particule but don't remember  ??? (an other not yours, think when above the sea)

And for your problem it's OFP, you need to create your own selection point in the addon, cz name does nothing.

Offline hardrock

  • Members
  • *
  • Title? What's that?
    • Operation FlightSim
Re: Where you are pointing at? part 2
« Reply #4 on: 27 May 2006, 16:10:43 »
Thanks Uiox, but, as indicated, firing is not an option, the unit should not fire, just aim. If the unit fires, the enemies nearby may detect your unit.
Apparently drops can't be placed at animated memory points. I once tried to read the RPM of a vehicle this way, by using an rpm animation together with a drop on the animated point meant to get the location of the point. The drop was always created at the center of the model though, which seems to have been the same problem as you're having now.

Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re: Where you are pointing at? part 2
« Reply #5 on: 27 May 2006, 18:03:32 »
You could try to use Fwatch (search from http://ofp2.info), more precisely it's mouse pointer related functions..
Although how would you calculate the direction where the weapon is pointing at from screen coords i another matter :P
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Where you are pointing at? part 2
« Reply #6 on: 27 May 2006, 21:42:56 »
Fwatch means players need that installed, so this is not an option.
Do selection names and drop work for vehicles (T80, T72, M1A1)? I cannot test as I have no idea which are these names.

Offline uiox

  • Contributing Member
  • **
Re: Where you are pointing at? part 2
« Reply #7 on: 27 May 2006, 22:01:11 »
1)Fwatch means players need that installed, so this is not an option.
2)Do selection names and drop work for vehicles (T80, T72, M1A1)? I cannot test as I have no idea which are these names.

1)Fwatch not work with linux so MP ...
2)For galix of the leclerc it was my first idea, not good idea, I use a dummy shot for have the rotation of the turret (you can have everything with a dummy shot)...

PS if you want to add a gun to vehicle forget this idea.
« Last Edit: 27 May 2006, 22:03:01 by uiox »

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Where you are pointing at? part 2
« Reply #8 on: 28 May 2006, 21:13:55 »
Uniox, by dummy shot do you mean the Fired eventhandler deleting the round?

Offline hardrock

  • Members
  • *
  • Title? What's that?
    • Operation FlightSim
Re: Where you are pointing at? part 2
« Reply #9 on: 28 May 2006, 23:50:23 »
Well, you could try creating a weapon with an invisible round and zero damage plus some other values to hide it. When you need the facing of the turret, you add the weapon, fire a round, select the round and its velocity, delete it and remove the weapon again. I don't know how well that would work, but theoretically it'd be possible.

Offline Blanco

  • Former Staff
  • ****
Re: Where you are pointing at? part 2
« Reply #10 on: 29 May 2006, 10:26:01 »
...or just wait until Arma comes out, I'm sure there will be a new command to handle this  :)
Search or search or search before you ask.