get-ray-collision-ground ( ray ground-height -- ray-collision )


Vocabulary
raylib

Inputs
raya Ray
ground-heighta float


Outputs
ray-collisiona RayCollision


Definition


:: get-ray-collision-ground
( ray ground-height -- ray-collision )
RayCollision <struct> ray direction>> y>> abs 0.000001 > [
ray position>> y>> ground-height -
ray direction>> y>> neg / :> distance distance 0.0 >= [
t >>hit distance >>distance dup normal>> 1.0 >>y
drop
ray position>> ray direction>> distance Vector3Scale
Vector3Add ground-height >>y >>point
] when
] when ;