Home   Help Search Login Register  

Author Topic: setting the angle of particle effects on missile drop?  (Read 1528 times)

0 Members and 1 Guest are viewing this topic.

Offline Odin

  • Members
  • *
G'day, I have been trying at this for a few days. What I have is a script I made for a gasbomb, while I am happy with the effects I would like it to look as though the initial missile strike comes in on an angle say of above 45degrees.

I have been reading the maths sections on the wiki and looking at Mandos scripts but I am truly at a loss.

Here is the missile part of my script and with the maths I have added.
Code: [Select]
#start
_array1 = []
_cnt = 0
_deg = random (359)

;missile part
_shell = "Barrel1" Createvehicle getMarkerPos "gas"
_shell setPosAsl [(getPos _shell select 0)+sin(_deg)*3 ,(getPos _shell select 1)+cos(_deg)*3,(getPos _shell select 2)+150 ]
"gas" setMarkerPos (getPos _shell)
 
#cinders
_PS4 = "#particlesource" createVehicleLocal getpos _shell

_PS4 setParticleCircle [0, [0, 0, 0]];
_PS4 setParticleRandom [0, [0.25, 0.25, 0], [0.175, 0.175, 0], 0, 0.25, [0, 0, 0, 0.1], 0, 0];
_PS4 setParticleParams [["\Ca\Data\ParticleEffects\FireAndSmokeAnim\FireAnim.p3d", 9, 2, 2], "", "Billboard", 1, 12.5, [0, 0, 0], [0, 0, 0.75], 0, 10, 7.9, 0.066, [1.2, 2, 4], [[1.99, 1.1, 1.1, 10], [0.25, 0.25, 0.25, 0.5], [0.5, 0.5, 0.5, 0]], [0.08], 1, 0, "", "", _shell];
_PS4 setDropInterval 0.02

#Fire

_ps3 = "#particlesource" createVehicleLocal getpos _shell

_ps3 setParticleCircle [0, [0, 0, 0]];
_ps3 setParticleRandom [0.2, [0.1, 0.1, 0], [0.5, 0.5, 0], 0, 1, [0.5, 0, 0, 0.1], 0, 0];
_ps3 setParticleParams [["\Ca\Data\ParticleEffects\FireAndSmokeAnim\SmokeAnim.p3d", 8, 2, 6], "", "Billboard", 1, 1, [0, 0, 0.5], [0.25, 0.25, 0], 0.3, 1, 7.9, 9, [0.5, 2, 4], [[0.7, 0.7, 0.7, 1], [0.25, 0.25, 0.25, 0.5], [0.5, 0.5, 0.5, 0]], [0.08], 1, 0, "", "", _shell];
_ps3 setDropInterval 0.009;
#lightTrail
_traillight = "#lightpoint" createVehicleLocal getpos _shell
_traillight setLightColor [0,0.3,1];
_traillight setLightAmbient [0.1,3,1];
_traillight setLightBrightness 0.02;
_traillight LightAttachObject [_shell,[0,0,0]];
#trail1
_ps = "#particlesource" createVehicleLocal getpos _shell

_ps setParticleCircle [0, [0, 0, 0]];
_ps setParticleRandom [10, [0.25, 0.25, 0], [0.175, 0.175, 0], 0, 0.25, [0, 0, 0, 0.1], 0, 0];
_ps setParticleParams [["\Ca\Data\missileSmoke", 8, 1, 8], "", "Billboard", 10, 12.5, [0, 0, 0], [0, 0, 0.75], 0, 10, 7.9, 0.075, [0.2, 2, 4], [[0.1, 0.1, 0.1, 1], [0.25, 0.25, 0.25, 0.5], [0.5, 0.5, 0.5, 0]], [10], 1, 0, "", "", _shell];
_ps setDropInterval 0.001;
~0.1
#trail1a
_ps1 = "#particlesource" createVehicleLocal getpos _shell

_ps1 setParticleCircle [0, [0, 0, 0]];
_ps1 setParticleRandom [10, [0.25, 0.25, 0], [0.175, 0.175, 0], 0, 0.25, [0, 0, 0, 0.1], 0, 0];
_ps1 setParticleParams [["\Ca\Data\ParticleEffects\RocketSmoke\RocketSmoke.p3d", 8, 3, 8], "", "Billboard", 0.1, 12.5, [0, 0, 0], [0, 0, 0.75], 0, 10, 7.9, 0.075, [0.2, 2, 4], [[0.1, 0.1, 0.1, 0.1], [0.25, 0.25, 0.25, 0.5], [0.5, 0.5, 0.5, 0]], [0.08], 1, 0, "", "", _shell];
_ps1 setDropInterval 0.005;
~0.1
~5
#trail2
_ps2 = "#particlesource" createVehicleLocal getpos _shell

_ps2 setParticleCircle [2, [-1, -1, -1]];
_ps2 setParticleRandom [0, [0.25, 0.25, 0], [0.175, 0.175, 0], 0, 0.25, [0, 0, 0, 0.1], 0, 0];
_ps2 setParticleParams [["\Ca\Data\ParticleEffects\FireAndSmokeAnim\FireAnim.p3d", 8, 1, 8], "", "Billboard", 1, 12.5, [0, 0, 0], [0, 0, 0.75], 0, 10, 7.9, 0.075, [1.2, 2, 4], [[0.5, 0.5, 0.1, 0.5], [0.25, 0.25, 0.25, 0.5], [0.5, 0.5, 0.5, 0]], [0.08], 1, 0, "", "", _shell];
_ps2 setDropInterval 0.05;

~0.5
; Delete Missile particle effects
deletevehicle _traillight
deletevehicle _ps
deletevehicle _ps1
deletevehicle _ps2

; Explosion part
_obj = "LOGIC" createVehicle position _shell;
~0.2

_posx = getpos _obj select 0
_posy = getpos _obj select 1
_posz = (getpos _obj select 2) - 2

drop ["\Ca\Data\kouleSvetlo.p3d","","Billboard",1,1.0,[_posx,_posy,_posz],[0,0,0],1,1.3,1.0,0.0,[50],[[1.0,0.7,0.4,0.8],[1.0,0.6,0.4,0.001]],[0],0.0,0.0,"","",""]
~0.1
#bomber=
_gas = "M_Maverick_AT" createVehicle position _obj;
deletevehicle _shell;
~0.5
;Destuction level
_seek = random 30
_xxpos = (getMarkerPos "gas" select 0)
_yypos = (getMarkerPos "gas" select 1)

_veharray = [_xxpos,_yypos,0] nearObjects ["Land", (15 + _seek)]
{_x setdammage ((getdammage _x) + 1)} forEach _veharray
_bldarray = [_xxpos,_yypos,0] nearObjects ["Static", (25 + _seek)]
{_x setdammage ((getdammage _x) + 1)} forEach _bldarray
~1

I get no errors, but also no change in the angle of decent. I do get movement on the position of the shell adjusting the cos/sin No. or if I use the Deg or Rad operators but then it wont hit the mark. Luke also provided me with these codes
Code: [Select]
_height =(getposasl shell select 2) - (getposasl target select 2);
_timetoimpact=sqrt(_height/4.9);
?_timetoimpact < 0:goto "lookout!"
_xdistance= (_getpos shell select 0) - (_getpos target select 0);
_ydistance= (_getpos shell select 1) - (_getpos target select 1);
shell setvelocity[(_xdistance/_timetoimpact),(_ydistance/_timetoimpact),0];
exit

#lookout!
hint "TOO LOW!!"
and
Code: [Select]
#height_provided

_targetheight= getposasl target select 2
_shellheight =_targetheight + _height
_distance = (_height * sin (90 - _angle))/(sin (_angle))
shell setpos [_distance * cos(_direction),_distance * sin(_direction), _height];
_timetoimpact=sqrt(_height/4.9);
_xdistance= (_getpos shell select 0) - (_getpos target select 0);
_ydistance= (_getpos shell select 1) - (_getpos target select 1);
shell setvelocity[(_xdistance/_timetoimpact),(_ydistance/_timetoimpact),0];

exit
#Distance_provided

_height=(_distance * sin (_angle))/(sin (90 - _angle))
_targetheight= getposasl target select 2
_shellheight =_targetheight + _height
shell setpos [_distance * cos(_direction),_distance * sin(_direction), _height];
_timetoimpact=sqrt(_height/4.9);
_xdistance= (_getpos shell select 0) - (_getpos target select 0);
_ydistance= (_getpos shell select 1) - (_getpos target select 1);
shell setvelocity[(_xdistance/_timetoimpact),(_ydistance/_timetoimpact),0];

exit

But again I can't seem to get them to work
If you need to see the entire script let me know

Any help appreciated
Odin

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: setting the angle of particle effects on missile drop?
« Reply #1 on: 02 Aug 2008, 09:13:34 »
If you need a missile attack comming from anywhere or from a existing vehicle, why dont you use mando missile as missile and your gas explosion script as warhead script for the missile?

Offline Luke

  • Members
  • *
  • Thank God! The OFPEC Staff are here!
Re: setting the angle of particle effects on missile drop?
« Reply #2 on: 02 Aug 2008, 20:25:15 »
Odin, the data I provided you 'should' be accurate in the phsical world, however if arma's gravity does not match 9.8 m/s or you use a rocket/missile object, then the maths probably wont be right.

Luke
Pesky Human!!
Wort Wort Wort.

Offline Odin

  • Members
  • *
Re: setting the angle of particle effects on missile drop?
« Reply #3 on: 03 Aug 2008, 00:38:35 »
Thx fellas, Maybe its not going to work because I am spawning a Barrel object 150m above the "gas" marker/target and attaching the effects to that. The Data you provided me Luke works without an error just no difference in angle. Thx Mandoble for sugesting to use the Mando_missile script, but as I say seeing as where the shell originates that may not work either, but cant hurt to try

Cheers
Odin

Offline Luke

  • Members
  • *
  • Thank God! The OFPEC Staff are here!
Re: setting the angle of particle effects on missile drop?
« Reply #4 on: 03 Aug 2008, 02:03:17 »
try using a "Bo_GBU12_LGB" rather than a barrel, that way it's guaranteed to fall,
and may possibly follow the physics

Luke
Pesky Human!!
Wort Wort Wort.

Offline Odin

  • Members
  • *
Re: setting the angle of particle effects on missile drop?
« Reply #5 on: 04 Aug 2008, 01:07:02 »
Thanx again Luke. I still couldnt get the maths you provided me to work within my script But switching from the "Barrel" to a "Bo_GBU12_LGB" offered some intresting results In the end I came up with this.
Code: [Select]
_deg = deg (100.5)

;missile part
_shell = "Bo_GBU12_LGB" Createvehicle getMarkerPos "gas"

_shell setPosAsl [(getPos _shell select 0)+sin(_deg)*-123.5,(getPos _shell select 1)+cos(_deg)*-123.5,(getPos _shell select 2)+200 ]

after allot of adjusting the deg/cos/sin I managed to get the bomb to land within 2 virtual feet of a roadcone representing the Marker pos  :clap:

only thing now is that when the particle effect starts for the trail they go straight up for a bit befor following the bomb, other than that it looks good, I think I can fix that prob easy enough though.

Cheers
Odin
« Last Edit: 04 Aug 2008, 01:08:51 by Odin »