Env quadraticbeam: Difference between revisions
Jump to navigation
Jump to search

Important:This entity has no additional KIO other than those that CBaseEntity already offers! Values listed under 'Fields' can only be accessed with an external plugin, or the NetProp manager found in certain VScript-supported titles (
and
).
(Every entity has CBaseEntity kio available so I listed only few notable ones that are more useful for this entity. Not sure what better word than kio to use instead of writing out all. alpha input may also be worth noting but haven't tested it) |
(Fix vscript example) |
||
Line 52: | Line 52: | ||
local end_pos = Entities.FindByClassnameNearest("prop_dynamic", eye_pos, 2048) | local end_pos = Entities.FindByClassnameNearest("prop_dynamic", eye_pos, 2048) | ||
// | //set control point to map origin (0 0 0) | ||
SpawnQuadBeam(start_pos, end_pos, | local control_pos = Vector() | ||
SpawnQuadBeam(start_pos, end_pos, control_pos) | |||
</syntaxhighlight> | </syntaxhighlight> | ||
Revision as of 06:46, 30 August 2024



![]() |
---|
CEnvQuadraticBeam |
![]() |
![]() |
---|
client side |
C_QuadraticBeam |
![]() |
env_quadraticbeam
is an 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.



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
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
PrecacheModel(model)
// spawn the beam and set the start point
local ent = SpawnEntityFromTable("env_quadraticbeam", { origin = start })
// 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)
// set the beam sprite
ent.SetModel(model)
}
//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", eye_pos, 2048)
//set control point to map origin (0 0 0)
local control_pos = Vector()
SpawnQuadBeam(start_pos, end_pos, control_pos)