How can I get a node to float on a water shaded plane?
I have a water shader. But I want to make an node float on it.
Assuming you have a heightmap for the wave displacement you could also use values from the heightmap to displace your nodes by.
I don't have a height map. Can I generate the height map from the shader, and fetch the height map?
I think a problem with creating and using a height map, is the height maps resolution cannot capture the details needed for such a large body of water.
I would like to cast a ray onto the water, take the intersection, then use that cordinate. It seems godot will not let me collision detect except for physics engine, physics body.
Does godot have the lower level API so I can do my own ray casting?
You can use PhysicsDirectSpaceState for raycasting in a low-level way, though it will still require use of the physics engine for the water.
I believe accessing the depth buffer might provide a solution here. But I do not know much about the depth buffer, or how to get access to it. Maybe the gdquest shader secrets will teach me how to do such things. With godot's version 4.0 and multithreaded physics coming, I think it would be possible to make an MMO.
Will the node remain stationary on the water? (Will it float around?) If not you might be able to displace its height with the same process you displace the water vertices.
- Edited
If you don't need "true" buoyancy, you can use an Area node that inverts gravity and increases dampening while the node is in the Area. The Area collision shape should be placed in a way that matches the water rendering.
I think creating a simulation in gdscript of the water shader is great idea. I only would need to calculate the one point. And using the origin as the UV. Plus I can fetch time from the shader by storing it in a variable. I think they would work.