Difference between revisions of "DCS func setPoint"

From DCS World Wiki - Hoggitworld.com
 
Line 53: Line 53:
 
}}
 
}}
 
[[Category:Class Functions|setPoint]]
 
[[Category:Class Functions|setPoint]]
 +
[[Category:Game Patch 1.2.6|setPoint]]

Latest revision as of 23:03, 17 March 2022

Scripting Root

Envrioment: Mission Scripting
Function: setPoint Added with: 1.2.6
Member Of: Spot
Syntax: function Spot.setPoint(Class Self , table vec3 )
Description: Sets the destination point from which the source of the spot is drawn toward.


Return Value: function
Return Example: none
Examples: The following will create a laser point and update the point of the ray every half a second. Once the target unit is destroyed it will remove the laser.
   local jtac = Unit.getByName('jtacBob')
   local target = Unit.getByName('BMPAirDefenseSystemGroup1_unit1')
   local ray = Spot.createLaser(jtac, {x = 0, y = 1, z = 0}, target:getPoint(), 1337)
   local function updateRay()
       if Object.isExist(target) then
           ray:setPoint(target:getPoint())
           timer.scheduleFunction(updateRay, {}, timer.getTime() + 0.5)
       else
           ray:destroy()
       end
   end
   timer.scheduleFunction(updateRay, {}, timer.getTime() + 0.5)
Related Functions: Spot Functions: createLaser. createInfraRed, destroy, getCategory, getPoint, setPoint, getCode, setCode
Notes: