Help with Interactable Grass Shader in Godot 4.3

Godot Version

v4.3

Question

Hello everyone,

I’m currently working on a project in Godot 4.3 where I want to create an interactable grass effect. The idea is that the grass should bend away when the player walks through it. I’ve been implementing this using a shader with a visual shader node setup, but I’m encountering some issues.

Issue Encountered

When I debug the output, it seems to only react to the (0, 0, 0) coordinates, and the bending doesn’t seem to scale with the player’s actual position.

I’m passing the player’s world position to the shader using the following GDScript:

extends Node3D

@export var player: Node3D
@export var shader_material: ShaderMaterial

func _process(delta):
if player and shader_material:
var player_pos = player.global_transform.origin
shader_material.set_shader_parameter(“player_position”, player_pos)

Here is the node setup:

If anyone has experience with creating interactable grass effects or working with shaders in Godot, I would greatly appreciate any insights or suggestions. Are there any common pitfalls I might have missed, or any adjustments to the node setup that could resolve this issue?

Thank you in advance for your assistance!