Ray:get_point
methodRay:get_point(distance: number) -> Vec3The point distance units along the ray from its origin.
-- 3 units from the origin, along the direction.
print(ray:get_point(3)) --> vec3(0.0, 1.0, -3.0)handle2 methods, 2 fields
A 3D ray: an origin and a normalized direction. Construct with datumhue.math.ray(origin, direction); returned by scene:screen_to_ray and accepted by the raycast APIs.
datumhue.math.ray, Scene:screen_to_raydatumhue.physics.raycast, datumhue.physics.raycast_all, datumhue.physics.shapecast, Scene:raycast, Voxel:raycast, PhysicsWorld:raycast, PhysicsWorld:raycast_all, PhysicsWorld:shapecastThe examples on this page start from:
local origin = datumhue.math.vec3(0, 1, 0)
local ray = datumhue.math.ray(origin, datumhue.math.vec3(0, 0, -1))| Field | Type | Access | Description |
|---|---|---|---|
origin | Vec3 | read-only | The ray's start point. |
direction | Vec3 | read-only | The ray's normalized direction. |
Ray:get_point(distance: number) -> Vec3The point distance units along the ray from its origin.
-- 3 units from the origin, along the direction.
print(ray:get_point(3)) --> vec3(0.0, 1.0, -3.0)Return the origin and (normalized) direction as two vec3 values.
local from, toward = ray:unpack()
print(from, toward) --> vec3(0.0, 1.0, 0.0) vec3(0.0, 0.0, -1.0)