User Tools

Site Tools


4rpl:commands:createbeam

This is an old revision of the document!


Index
Beams

CreateBeam

CreateBeam(<-color <-brightness <-width) ->beamUID

Description

Creates a beam. Beams are laser like lines between two points in 3D space. A beam will persist once created. Call DestroyBeam to remove a beam. Don't call CreatBeam repeatedly unless you plan to make more than one beam. Each call creates a new beam that will persist until destroyed. If you are creating a beam for a unit, call CreateBeam in a once clause (or some other initialization function) then reference that beam in the unit. You can toggle the beam's visibility rather than creating, destroying, and recreating the beam. Toggling the visibility is more efficient that creating and destroying a beam. If you attach a beam to a unit, the beam will be destroyed if the unit is destroyed. CreateBeam pushes to the stack a unique ID for the created beam. Use this ID in other beam related calls to reference the beam. A value of -1 is pushed to the stack if the beam creation fails. A MAXIMUM OF 4096 BEAMS IS ALLOWED.

  • 'Color' is a string. Possible values are “black”, “red”, “orange”, “yellow”, “green”, “blue”, “purple”, “white”.
  • 'brightness' is a float ranging from 0 to 10. A value of 0 makes the beam totally black. A value of 1 is fully colored. Values above 1 increase the brightness into the HDR glow range.
  • 'width' is a float ranging from 0 up. The width is the thickness of the beam. Beams are flat geometry so keep the beam width relatively small (1-10 typically).

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 ourself, 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(10 0 20))
endonce

Index

4rpl/commands/createbeam.1618492458.txt.gz · Last modified: 2021/04/15 09:14 by virgilw