DCS func setPoint

From DCS World Wiki - Hoggitworld.com
Revision as of 03:31, 2 November 2021 by Grimes (talk | contribs)

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: