Appearance
helix / ScoreVec3
Class: ScoreVec3
Defined in: core/frontend/nodes/score_vec3.ts:19
Three scoreboard slots treated as a single vector, so vector algebra over scores reads as algebra instead of three near-identical scoreboard players operation lines per axis per step. Every method delegates to Score's typed ops and emits into the ambient context (the build/run/if callback you are inside); pass ctx to override it, exactly like Score.
It holds references to three existing Score slots and allocates nothing - the caller owns where each component lives. That makes one class serve both roles a score-vector takes: a value (three per-player objectives bound to a selector, e.g. an anchor position) and a scratch register (three slots on a work objective). Scores are integers, so divide floors toward −∞.
Chainable like Score: v.assign(a).sub(b).scale(k).
Constructors
Constructor
new ScoreVec3(
x,y,z):ScoreVec3
Defined in: core/frontend/nodes/score_vec3.ts:20
Parameters
x
y
z
Returns
ScoreVec3
Properties
x
readonlyx:Score
Defined in: core/frontend/nodes/score_vec3.ts:21
y
readonlyy:Score
Defined in: core/frontend/nodes/score_vec3.ts:22
z
readonlyz:Score
Defined in: core/frontend/nodes/score_vec3.ts:23
Accessors
components
Get Signature
Defined in: core/frontend/nodes/score_vec3.ts:27
The three components as a tuple (e.g. for store result score reads).
Returns
readonly [Score, Score, Score]
Methods
add()
add(
other,ctx?):this
Defined in: core/frontend/nodes/score_vec3.ts:40
this += other.
Parameters
other
ScoreVec3
ctx?
Returns
this
assign()
assign(
other,ctx?):this
Defined in: core/frontend/nodes/score_vec3.ts:32
this = other (component-wise =).
Parameters
other
ScoreVec3
ctx?
Returns
this
clamp()
clamp(
lo,hi,ctx?):this
Defined in: core/frontend/nodes/score_vec3.ts:72
Clamp every axis into [lo, hi] (< hi then > lo).
Parameters
lo
hi
ctx?
Returns
this
divide()
divide(
k,ctx?):this
Defined in: core/frontend/nodes/score_vec3.ts:64
Divide every axis by the scalar score k (/=, integer floor).
Parameters
k
ctx?
Returns
this
dot()
dot(
other,out,scratch,ctx?):Score
Defined in: core/frontend/nodes/score_vec3.ts:85
Dot product into out, using scratch for the cross terms - both caller-owned scalar slots, distinct from this vector's components:
out = x·o.x + y·o.y + z·o.z
Parameters
other
ScoreVec3
out
scratch
ctx?
Returns
lengthSquared()
lengthSquared(
out,scratch,ctx?):Score
Defined in: core/frontend/nodes/score_vec3.ts:100
Squared length |v|² = v·v (into out, via scratch).
Parameters
out
scratch
ctx?
Returns
scale()
scale(
k,ctx?):this
Defined in: core/frontend/nodes/score_vec3.ts:56
Scale every axis by the scalar score k (*=).
Parameters
k
ctx?
Returns
this
sub()
sub(
other,ctx?):this
Defined in: core/frontend/nodes/score_vec3.ts:48
this -= other.
Parameters
other
ScoreVec3
ctx?
Returns
this