Skip to content

raylib.Vector2Refract

JoeStrout edited this page Nov 16, 2026 · 3 revisions

Compute the direction of a refracted ray. v: normalized direction of the incoming ray; n: normalized normal vector of the interface between the two media; r: ratio of the refractive index of the medium the ray comes from to that of the medium on the other side

Parameters

Parameter Default Value Note
v [0, 0]
n [0, 1]
r 1

Return value

Condition Return Value
(always) list

Notes

Example

v = [0, -1]      // normalized incoming ray (straight down)
n = [0, 1]       // surface normal pointing up
r = 0.9          // ratio of refractive indices
result = raylib.Vector2Refract(v, n, r)
print result

Clone this wiki locally