Home   Help Search Login Register  

Author Topic: Targeting Missiles  (Read 832 times)

0 Members and 2 Guests are viewing this topic.

Jim666

  • Guest
Targeting Missiles
« on: 26 Feb 2005, 13:47:20 »
In my cutscene ive got a helicopter that takes off, and a theres an enemy AA solider like in a bush near by and i want the camera to follow the missile he fires at the chopper when it takes off, is this possible?

Offline bedges

  • Administrator
  • *****
    • OFPEC The Editing Center
Re:Targeting Missiles
« Reply #1 on: 26 Feb 2005, 14:08:14 »
i remember seeing such an effect in the superb mission "The Black Gap" by Sui - look it up if you haven't already got it. in that particular case it was a missile leaving an anti-tank weapon, but i assume the process is the same.

get the mission, dePBO it and see how the maestro did it.

Offline Sui

  • Former Staff
  • ****
    • OFPEC
Re:Targeting Missiles
« Reply #2 on: 27 Feb 2005, 13:15:19 »
I sort of cheated in The Black Gap... I didn't actually target the rocket, but switched the cam from the Shooter to the Tank he was shooting at ;)
As a result it looked like it was following the flight path of the rocket...

However in the Loose outro in Facile Ground I targeted an AT rocket. Here's the code I used:

Quote
_now = (time + 7)
#OLatguyloop
~0.01
atguy dofire ftruck
? (atguy ammo "AT4Launcher" == 1) and (alive atguy) and (time < _now): goto "OLatguyloop"
_at4 = (nearestobject [atguy,"AT4"])
setacctime 0.05
~0.2
_cam camsetpos [(getpos _at4 select 0) + sin (getdir _at4 + 5) * 20, (getpos _at4 select 1) + cos (getdir _at4 + 5) * 20, 1]
_cam camsettarget _at4
_cam camcommit 0

First off... ignore the camsetpos line.
What you're interested in is the _at4 = (nearestobject... line. Once you assign the rocket to a variable, you can target it just like anything else.
You need to grab it pretty much as soon as it's fired, because nearestobject only has a range of 50m. Hence the loop detecting when his ammo is 0 (ie he's got no ammo because he's fired).

Also, be aware that to get the camera shot to work (ie. look good) you need to use slow motion. Not necessarily as slow as I have here, but definitely much slower than usual.

A possibly more reliable method is to use the fired eventhandler, as that may work quicker than the dodgey loop I've got up there. Anyway, up to you :)


Offline OFPWiZard

  • Members
  • *
Re:Targeting Missiles
« Reply #3 on: 27 Feb 2005, 23:01:05 »
I had info about that, i thought you would have know it yourself.

I had created a few things with it... look at your forums, i'll put it up in there.

I used an eventHandler

bored_onion

  • Guest
Re:Targeting Missiles
« Reply #4 on: 01 Mar 2005, 22:28:03 »
i also made one for this kind of thing. check this thread:

http://www.ofpec.com/yabbse/index.php?board=9;action=display;threadid=19327

my entry has an attachment with an example. if not there are some bullet cameras in the ed depot.