raycast at 100 studs distance
or
lastpos
for i = 1, 10 do
raycast at 10studs from lastpos
if result then break
end
what is better for memory?
raycast at 100 studs distance
or
lastpos
for i = 1, 10 do
raycast at 10studs from lastpos
if result then break
end
what is better for memory?
1 long raycast. It’s always better (for the memory) to do one thing than to do 10 smaller things. And it’s faster too. Also, 100 studs is a really small distance, you should worry about something like this when you try to raycast to thousands of studs away
1 long one is easier to deal with tbh. but 10 smaller ones do give more data, but ehhhhh i would still prefer 1 long one.
As far as I can remember, a staff member conformed that the factor that changes a raycast’s speed and performance is the distance, not the amount. So, 10 smaller raycasts would be, in theory, faster than 1 long raycast. Not sure if this behavior changed or not.
ikr thats my point im asking yknow???
I would benchmark it some time later, but if you aren’t casting rays alot (aka, when making a hitbox for a melee), you would be generally fine with a long ray.