Skip to content

Arrow ​

Visual debug primitive representing a 3D directional arrow.

Arrow is a lightweight scene node used for debugging spatial relationships: normals, force vectors, light directions, coordinate axes, or any vector-based visualization. The arrow is defined by an origin point, a direction, a length, and a color. Its geometry is generated automatically and updates whenever the direction or origin is changed.

cpp
my_scene->Add(vglx::Arrow::Create({
  .direction = {1.0f, 0.0f, 0.0f},
  .origin = Vector3::Zero(),
  .color = 0xFF0000u,
  .length = 1.0f
}));

INFO

Derives from Node and inherits all public properties and methods.

Construction ​

Constructors ​


Arrow() ​

Constructs an arrow node from the given parameters.

cpp
Arrow::Arrow(const Parameters& params);
ParameterDescription
paramsInitialization parameters for constructing the arrow.

Factories preferred ​


Arrow::Create() std::unique_ptr<Arrow> ​

Creates an instance of Arrow with default parameters.

cpp
static std::unique_ptr<Arrow> Arrow::Create();

Arrow::Create() std::unique_ptr<Arrow> ​

Creates an instance of Arrow.

cpp
static std::unique_ptr<Arrow> Arrow::Create(const Parameters& params);
ParameterDescription
paramsInitialization parameters for constructing the arrow.

Types ​

Arrow::Parameters struct ​

Parameters used to construct an Arrow object.

ParameterDescription
direction Vector3Direction vector of the arrow.
origin Vector3World-space origin of the arrow.
color ColorArrow color.
length floatLength of the arrow in world units.

Functions ​

SetDirection() void ​

Updates the direction of the arrow.

Automatically recalculates the internal transform so the arrow points in the new direction.

cpp
void Arrow::SetDirection(const Vector3& direction);
ParameterDescription
directionNew direction vector.

SetOrigin() void ​

Updates the origin of the arrow.

Moves the base of the arrow to the given world-space point.

cpp
void Arrow::SetOrigin(const Vector3& origin);
ParameterDescription
originNew origin position.

Released under the MIT License.