User Tools

Site Tools


4rpl:commands:unattachbeam

Index
Beams

UnattachBeam

UnattachBeam(<-beamUID)

Description

Unattaches a beam to a unit. When a beam is attached to a unit, the beam's start position becomes relative to the unit. This allows the beam start to follow the unit around if the unit moves. The end position remains in world coordinates, unless SetBeamForceLocalEnd is called on the beam.

Examples

once
   GetUnitPosition(self) ->unitPos
   #Fire a beam to extends off screen but is at the same height as the unit
   #We will attach the beam to ourselves, so that the start point is relative to our unit
   3 ->brightness
   4 ->width
   CreateBeam("orange" <-brightness <-width) ->beam
   AttachBeam(<-beam self "")
   SetBeamStart(<-beam V3(0 0 0))
   SetBeamEnd(<-beam V3(10000 0 10000))
endonce
 
if (GetUnitUpdateCount 900 % 0 ==) #unattach from unit after 900 frames
   UnattachBeam(<-beam)
endif

Index

4rpl/commands/unattachbeam.txt · Last modified: 2021/04/15 12:35 by Karsten75