Combine Hit position output from 2 separate Raycasts?

Normally, I’d use 2 separate Set position nodes, each for it’s respective Raycast direction, but I just thought “Hey, what not to combine both somehow together?”

It probably is possible, but I suck at math. So if anyone would feel like filling the gap here, I’d appreciate it!

Here’s the problem. Instead of having 2x “Set position” nodes after each other, let’s try to combine this operation using only single Set position node.

Desired result:

Top 2 Set position nodes are my old way to go about this. Can someone combine these two inputs to work for a single node instead?

You just need to define a different ‘Source Position’…
If you start your raycast from the floor plane (Z = 0.0) and you need to check both up and down spaces, you need to cast two rays.
But if you start for example at Z=-5.0, in the up direction, you’ll get the results you need.
(or Z=5.0 and direction down)

Hello,
It’s not a math problem, it’s more about getting how GN works …
I think you should use a mix value or a switch, basically you want to use the second raycast if it hits something, then the Is Hit is the mixing/switching factor, if you get what I mean…

1 Like

This is very unintuitive for me, because I’d expect only a slight change in the end shape, not flat out flat grid.

That sounds like it’s gonna bend the mesh only in a one direction, not both? Unless I’m gonna use 2x Set position again?

Anyway, from a quick check at timing, it seems that even just adding another Raycast into selection for a single Set Position doubles the overall timing. Tried it a few times. Making this walkaround effort effectively meaningless.

5 Likes

Aaah! Thanks for the demonstration. This does what I wanted. Although it seems to be equally demanding. But it’s great to know this anyway. If anything, it will keep my node tree little less cluttered. Thanks!