User Tools

Site Tools


4rpl:commands:setbeamwidth

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
4rpl:commands:setbeamwidth [2021/01/08 16:01] – external edit 127.0.0.14rpl:commands:setbeamwidth [2025/02/14 14:57] (current) – external edit 127.0.0.1
Line 1: Line 1:
 ~~NOTOC~~ ~~NOTOC~~
-<=[[4rpl:start| Index]]+<=[[4rpl:start| Index]] \\ 
 +<-[[4rpl:start#beams| Beams]] 
  
 ====== SetBeamWidth ====== ====== SetBeamWidth ======
Line 8: Line 10:
 Set a beam's width. The width is the thickness of the beam. Beams are made from flat geometry that attempts to face the player camera (as best it can). Set a beam's width. The width is the thickness of the beam. Beams are made from flat geometry that attempts to face the player camera (as best it can).
 Because of this it is generally better to keep width relativly small (under 10 in most cases). Because of this it is generally better to keep width relativly small (under 10 in most cases).
 +
 +:NOTE: Beams become very difficult to see from long distances when they are a size lower than 0.35 so if you want the beam to always be visible, keep the width at a minimum of 0.35.\\
 +This can also be useful when using a large number of beams such as targeting lasers for decorating purposes rather than functional purposes to ensure the player's screen is not flooded with beams when zoomed out when using many of that unit.
  
 ===== Examples ===== ===== Examples =====
Line 14: Line 19:
    GetUnitPosition(self) ->unitPos    GetUnitPosition(self) ->unitPos
    #Fire a beam to extends off screen but is at the same height as the unit    #Fire a beam to extends off screen but is at the same height as the unit
-   #We will attach the beam to ourselfs, so that the start point is relative to our unit +   #We will attach the beam to ourselves, so that the start point is relative to our unit 
-   CreateBeam("orange" 3 1  0 1 0  10000 <-unitPos.Y 10000) ->beam +   3 ->brightness 
-   AttachBeam(self <-beam)+   4 ->width 
 +   CreateBeam("orange" <-brightness <-width) ->beam 
 +   AttachBeam(<-beam self ""
 +   SetBeamStart(<-beam V3(0 0 0)) 
 +   SetBeamEnd(<-beam V3(10000 0 10000))
 endonce endonce
  
 GetUnitUpdateCount mod (5) ->width GetUnitUpdateCount mod (5) ->width
-SetBeamWidth(<-beam self) +SetBeamWidth(<-beam <-width)
-endif +
  
 </code> </code>
 <=[[4rpl:start| Index]] <=[[4rpl:start| Index]]
  
4rpl/commands/setbeamwidth.1610121708.txt.gz · Last modified: 2025/02/14 14:56 (external edit)