Is it possible for a ray to turn?

Is it possible for a ray to turn? if is how you do it?

Yes, kindaa, you can cast the ray in segment which is what Fastcast does to mimic gravity for raycasted bullets essentially turning the direction of the ray.

Edit: This diagram below the initial post should illustrate it better:

The cones represent the ray.

is it possible to do this or not and thx that module will help

wahtiw

or something that can do that with raycasting

yes, you just need to make multiple casts.

You make a cast up to the corner of the turn, and then another cast from the corner to the end.

A single cast can only simulate itself in a straight line, but there’s nothing stopping you from making multiple casts.

I can’t give you full code right now since I’m a bit busy; but if you understand vector3s + raycasts, it’s not so difficult.

I actually don’t understand that much with vector3 and recast and i really suck at Lua math and yes i am a beginner i was wondering how would you get the end of the ray cast vector of the first cast
and sorry if it too much to ask to much

1 Like

You can research it online but yeah here:

You need to add the World origin of where the ray was cast and the ray vector to get the end position.

2 Likes

Thanks, man this was helpful and thx for giving me a link to show me a example.

2 Likes