Skip to content

raylib.Vector2Refract

JoeStrout edited this page Apr 29, 2026 · 2 revisions

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

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