Home   Help Search Login Register  

Author Topic: nearestObject 2 slow ?  (Read 1555 times)

0 Members and 1 Guest are viewing this topic.

Offline LCD

  • Former Staff
  • ****
    • Everon Cartel
nearestObject 2 slow ?
« on: 04 Jul 2007, 01:13:33 »
im tryin 2 create a cutscene were da camera follows a bullet da player just shot... using  fired eventhandler and a nearestobject command... but it seems da nearestobject keeps on missing da bullet... od ny1 knows a workaround ???

LCD OUT
"guess being the community has downsides .." - cheetah
Help Perfecting Da Next Best Thing - O-Team Beta

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: nearestObject 2 slow ?
« Reply #1 on: 04 Jul 2007, 01:30:34 »
try with SQS instead of SQF, you may be surprised.

Offline LCD

  • Former Staff
  • ****
    • Everon Cartel
Re: nearestObject 2 slow ?
« Reply #2 on: 04 Jul 2007, 01:45:40 »
u mean sqf instead of sqs ??? cuz im usin sqs right now :confused:

nywayz im usin ur script mandoble... so mebe... ???

LCD OUT
"guess being the community has downsides .." - cheetah
Help Perfecting Da Next Best Thing - O-Team Beta

Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re: nearestObject 2 slow ?
« Reply #3 on: 04 Jul 2007, 01:54:56 »
How exactly you use the nearestObject?
In the script executed by the eventHandler or 'in' the eventHandler?

The bullet is way too fast to be succesfully detected in the executed script (extremely sensitive to FPS), it should be 'caught' in the eventHandler, as such:
Code: [Select]
this addEventHandler ["fired",{(nearestObject [_this select 0, _this select 4]) execVm "thescript.sqf"}]Now you just refer to the bullet in the script with _this

When cathing the bullet in the eventHandler it's muzzle velocity can be something like 500 000m/s and it still gets caught..
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.

Offline JasonO

  • OFPEC Patron
  • ****
  • Oh no...
    • The New Life RPG
Re: nearestObject 2 slow ?
« Reply #4 on: 05 Jul 2007, 01:38:15 »
I noticed in my bullet cam script that it takes about 1/4 of a second to 1/2 of a second for the bullet to be detected before followed. I never overcome the problem. Format was a fast SQS loop (0.0025 I think).

Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re: nearestObject 2 slow ?
« Reply #5 on: 05 Jul 2007, 12:35:38 »
That eventhandler thing should work, we tested it extensively during the developement of MCAR.

Of course we used it from config eventHandlers but it shouldn't matter, at least (IIRC) in OFP the mission set eventHandlers 'fired' before the configged ones..
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.