Skip to main content
Version: 0.10.0

UeArrowHelper

Visual helper that represents a 3D arrow using a shaft (line) and a head (cone).

This is useful for debugging vectors like directions, normals, or rays.


Constructor​

new UeArrowHelper(dir, origin, length, color, headLength, headWidth)

Inherits from UeLineSegments

Parameters​

ParameterTypeDefaultDescription
dirVector3Direction vector (must be normalized or will be normalized).
originVector3Starting point of the arrow.
lengthnumber1Total length of the arrow.
colorColorc_yellowColor of both the shaft and the head of the arrow.
headLengthnumber0.1 * lengthLength of the arrowhead (cone).
headWidthnumber0.2 * headLengthWidth of the arrowhead (cone).

Properties​

PropertyTypeDescription
lineUeLineThe line segment that forms the shaft of the arrow.
coneUeMeshThe cone mesh that forms the arrowhead.

Methods​

MethodReturnsDescription
setDirection(dir)selfUpdates the arrow's orientation to point in the new direction. Will be normalized
setLength(length, headLength, headWidth)selfChanges the overall size of the arrow.
setColor(color)selfChanges the color of both the line and cone parts.

Usage​

var dir = vec3_create(0, 1, 0);
var origin = vec3_create(10, 0, 0);
var arrow = new UeArrowHelper(dir, origin, 100, c_lime);
scene.add(arrow);