pub const RAY: &str = "type Ray {\n origin: Vec3 = Vec3 {};\n direction: Vec3 = Vec3 { z: -1 };\n length: Number = 1;\n}";Expand description
A visual ray with an explicit finite length.
The adapter requires direction magnitude greater than 1e-12 and positive length. It normalizes an accepted direction before building the rendered line.
§Declaration
type Ray {
origin: Vec3 = Vec3 {};
direction: Vec3 = Vec3 { z: -1 };
length: Number = 1;
}§Fields and methods
-
origin: Local origin in meters; defaults to zero. -
direction: Local direction; spatial conversion requires magnitude greater than 1e-12 and normalizes the vector. -
length: Visible distance in meters; defaults to 1.
§Create a ray
The default direction is local negative Z.
let entity = spawn(Ray {});
print(get[Ray](entity).direction.z);