env_quadraticbeam
![English (en) English (en)](/w/images/3/37/Flag-en.png)
![Translate (Translate) Translate (Translate)](/w/images/a/a8/Flag-Translate.png)
![Info.png](/w/images/thumb/b/b3/Info.png/44px-Info.png)
![]() |
---|
CEnvQuadraticBeam |
![]() effects.cpp
|
![]() |
---|
client side |
C_QuadraticBeam |
![]() c_effects.cpp
|
env_quadraticbeam
is a entity available in all Source games. It is a duplicate of the
beam
entity, but with ability to arc by using a quadratic equation. It can be used to produce a similar effect to the physics gun. The formula used to form the curve can be found here.
![Icon-Important.png](/w/images/thumb/5/5c/Icon-Important.png/10px-Icon-Important.png)
![Team Fortress 2](/w/images/thumb/8/84/Tf2-16px.png/16px-Tf2-16px.png)
![Left 4 Dead 2](/w/images/thumb/8/8b/Icon-L4D2.png/16px-Icon-L4D2.png)
Fields
m_targetPosition <FIELD_POSITION_VECTOR>
- END point
m_controlPosition <FIELD_POSITION_VECTOR>
- CONTROL point (see picture)
m_scrollRate <FIELD_FLOAT>
- Must be value between -4, 4
m_flWidth <FIELD_FLOAT>
Notable KIO
![Note.png](/w/images/thumb/c/cc/Note.png/10px-Note.png)
model
keyvalue does not work for setting the sprite, it must be set after spawning.Keyvalues
- Origin
(origin)
<vector> - Start point of the beam
Inputs
Color
<color255>- Changes color
Spawning via vscript example
function SpawnQuadBeam(start, end, control, color="255 0 0", model="sprites/laserbeam.spr") {
// precache the beam sprite
if (!IsModelPrecached(model))
PrecacheModel(model)
// spawn the beam and set the start point
local ent = SpawnEntityFromTable("env_quadraticbeam", {
origin = start
// model = model //model doesn't work here, need to SetModel after spawning
})
// set the beam sprite
ent.SetModel(model)
// set the end point for the beam
NetProps.SetPropVector(ent, "m_targetPosition", end)
// set the control point for the curve
NetProps.SetPropVector(ent, "m_controlPosition", control)
NetProps.SetPropFloat(ent, "m_scrollRate", 2)
NetProps.SetPropFloat(ent, "m_flWidth", 5)
// set the beam color
DoEntFire("!self", "color", color, 0, null, ent)
}
//Draw a beam from the players origin point to the nearest prop_dynamic in a 2048hu radius
local start_pos = GetListenServerHost().GetOrigin()
local end_pos = Entities.FindByClassnameNearest("prop_dynamic", start_pos, 2048).GetOrigin()
//set control point to map origin (0 0 0)
local control_pos = Vector()
SpawnQuadBeam(start_pos, end_pos, control_pos)