simvx.core.math.raycast

Raycasting helpers: screen-to-ray and ray-sphere intersection.

Module Contents

Functions

screen_to_ray

Convert a screen pixel coordinate to a world-space ray (origin, direction).

ray_intersect_sphere

Ray-sphere intersection. Returns distance t or None if no hit.

API

simvx.core.math.raycast.screen_to_ray(screen_pos, screen_size, view, proj)[source]

Convert a screen pixel coordinate to a world-space ray (origin, direction).

Returns (origin, direction) as Vec3.

simvx.core.math.raycast.ray_intersect_sphere(origin, direction, center, radius: float)[source]

Ray-sphere intersection. Returns distance t or None if no hit.