OFPEC Forum

Editors Depot - Mission Editing and Scripting => Arma2 - Editing/Scripting General => Topic started by: Lone~Wolf on 08 May 2014, 13:23:26

Title: Doing Raytracing in ArmA 2 and OFP
Post by: Lone~Wolf on 08 May 2014, 13:23:26
How the hell do you do raytracing? (Calculating the place where a straight-line fired from a position first hits a solid object)

I found an old thread which suggested making a camCreate smokegrenade and giving it a very high setVelocity, then updating its position to a variable when the velocity became zero.
 http://www.ofpec.com/forum/index.php?topic=22254.0 (http://www.ofpec.com/forum/index.php?topic=22254.0)
Apparently this worked well. However, I was hoping for something with a bit more finesse.

Someone in the same thread suggested abusing the game's inherent LaserDesignator which accurately paints a spot (whose position can be read by scripts).

For many years I had the idea of creating a new bullet for ArmA 2 or OFP which had no damage, no sound, no tracer and no impact animations - just for the purpose of raytracing.

Does anyone have any ideas? I think the solution would be useful to everybody.
Title: Re: Doing Raytracing in ArmA 2 and OFP
Post by: h- on 09 May 2014, 09:49:59
In A2 you could try fiddling with lineIntersects (http://www.ofpec.com/COMREF/index.php?action=details&id=1401&game=All) or lineIntersectsWith (http://www.ofpec.com/COMREF/index.php?action=details&id=1402&game=All) (both OA only).
Obviously this reguires prior knowledge on whether the object type in guestion is solid or not, but basically Strategic and NonStrategic are, etc..

Someone probably has better ideas though.