I know this is inefficient but luckily that is besides the point of what I'm doing lol I'm trying to figure out how to use castray to get one node's position and getting it to project along a vector in the direction of another node. The node positions I can get, but my lack of coding knowledge is showing, and I can't find out how to cast a ray with this information I've even tried to copy some code from official mods, but no matter what it throws an error saying "attempt to call global 'castRay' a nil value" (or castRayStatic for testing if I get a different result) what I'd love is someone to either direct me to clear documentation for idiots like me, or make a simple example controller lua file that gives a distance to the ground for reference (I was directed to the avro arrow in searching for info, but I couldn't understand how they used it, and couldn't even retrofit it to my own thing)
alternatively if a dev does make the documentation for this, can they please link it here when it's done. As for now I'm going to give up on this
To get distance to the ground I used 'be:getSurfaceHeightBelow(vec3(x, y, z))' function. It helped me to implement into my latest mod the 'teleporting to the ground level' option (a player clicks the button and the vehicle teleports to the ground level)
hmmm not quite what I wanted, I need it to be on a specific trajectory. Alternatively if it was instead "getNearestGround" or similar it'd work, otherwise things like banking wouldn't work as intended. it'd be close, but I present things in a very specific way in my videos, and I like to be fastidious about -certain- things. Not to mention that there's other situations where I've needed to know how to use castray, and I still can't figure it out
In my latest mod, I used ray casting to track player's cursor and set depth of field distance: https://www.beamng.com/threads/manual-focus-v-1-0.98355/ Maybe it will help!
I've not looked much into raycast as it seems to be only mouse orientated as far as I can tell. Since posting this though, I have learned more about how to get nodes, and beams into lua, so maybe I'll be able to look at doing this again. one other thing I learned is that I am unable to use anything in beamng.tech (as far as I'm aware), so that kinda sucks or I'd set it up like a lidar