Immediate ray cast result

I would like to get the result of a ray cast immediately (a return value of the physics.ray_cast() call).

I understand that this is tricky since you have a physics update that comes later in the cycle, but I can do this in other engines and it is immensely useful as well as easier to use.

1 Like

What about the ability to pass a lua function to the call, which would receive and take action on the result? Or do you actually need it instantly in the same frame?
My question paraphrased would be: are you more interested in code structure and being able to store the closure of things and handle the ray cast result, or are you more interested in frame times and getting an instant result to avoid frame delays? If the latter, what is your specific use case?

My highest priority here is actually the immediate result, like when making laser-sight type fx where I would either get frame delay on the movement of it or a frame delay on the hit-result.

As for the structure, it’s always nice being able to just fire, make calculations and keep going, rather than fire and then do all the calculations somewhere else. Passing a function could definitely come in handy

The ease of use-problems that I have are however not a huge deal for my workflow right now. My use case right now is that I have one "bullet manager"script-component that handles all the logic for my beams, projectiles and damage fields, and since the tools are clearly built around the idea of logic being handled on separate components on game objects, I realize that I’ll have to deal with some stuff because of that.