OFPEC Forum

Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting General => Topic started by: LCD on 04 Jul 2007, 01:13:33

Title: nearestObject 2 slow ?
Post by: LCD 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
Title: Re: nearestObject 2 slow ?
Post by: Mandoble on 04 Jul 2007, 01:30:34
try with SQS instead of SQF, you may be surprised.
Title: Re: nearestObject 2 slow ?
Post by: LCD 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
Title: Re: nearestObject 2 slow ?
Post by: h- 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..
Title: Re: nearestObject 2 slow ?
Post by: JasonO 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).
Title: Re: nearestObject 2 slow ?
Post by: h- 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..