IcterusGames / SimpleGrassTextured

Plugin to make grass on Godot 4
MIT License
163 stars 16 forks source link

Is there any limit range (distance) of the interactive mode? #17

Open nagasawamaki opened 4 months ago

nagasawamaki commented 4 months ago

I tried to paint the grass with interactive mode.

But found that for some grass which painted far away (around more than 20m from the global origin) will not interact with my character.

So may I ask is there any limit on the range (distance) of the grass for interactive mode? Or am I missing something to set it properly?

Thanks.

PS. found the below error in Godot: E 0:00:01:0369 instance_set_custom_aabb: Condition "!is_geometry_instance(instance->base_type)" is true. <C++ Source> servers/rendering/renderer_scene_cull.cpp:1019 @ instance_set_custom_aabb()

PS2. seems the above error is not corresponded to the no interactive situation.

IcterusGames commented 4 months ago

Are you updating SimpleGrassTextured by calling SimpleGrass.set_player_position(global_position) on _process or _physics_process function of your character/camera node ? Note: look step 5 on readme.md

yythlj commented 3 months ago

The grass patches in my SimpleGrass node do not dynamically move along with the player's position, even though _process and _physics_process are called correctly (and SimpleGrass's interactive mode is also correctly set), using the default grass mesh.

I am using SimpleGrass.set_player_position(global_position) but the grass does not follow the player. I have also correctly added the player body3d node with a 17 collision mask.

Could this be related to how my node is using a new window mode/new world3d that is created? I am using the following code to add a newwindow node to get_tree().get_root():

haxe 复制 func OpenWorld(nodeName, idx, data=null):

var worldNew = widx_map[idx].instantiate() var newwindow = Window.new()

newwindow.set_embedding_subwindows(true) newwindow.set_disable_input(false) newwindow.set_handle_input_locally(true) newwindow.set_flag(Window.FLAG_NO_FOCUS, false) newwindow.set_transient(true)

newwindow.set_world_3d(World3D.new()) newwindow.set_use_own_world_3d(true)

newwindow.set_name(nodeName) instance_map[nodeName] = newwindow

get_tree().get_root().add_child(newwindow)

worldNew.set_name(nodeName)
worldNew.Init()

newwindow.add_child(worldNew) worldNew.OnGoto(data)

newwindow.set_size(get_tree().get_root().get_size()) The terrain3d node is added as a child of the node3d node, which is then a child of the newwindow node. The SimpleGrass node is then a child of the terrain3d node's scene.

please tell me if using a new window/world setup could be causing the grass to not follow the player properly.my english is not good ,sorry

yythlj commented 3 months ago

image this is the node3d node

IcterusGames commented 3 months ago

The grass patches in my SimpleGrass node do not dynamically move along with the player's position, even though _process and _physics_process are called correctly (and SimpleGrass's interactive mode is also correctly set), using the default grass mesh.

I am using SimpleGrass.set_player_position(global_position) but the grass does not follow the player. I have also correctly added the player body3d node with a 17 collision mask.

Could this be related to how my node is using a new window mode/new world3d that is created? I am using the following code to add a newwindow node to get_tree().get_root():

haxe 复制 func OpenWorld(nodeName, idx, data=null):

var worldNew = widx_map[idx].instantiate() var newwindow = Window.new()

newwindow.set_embedding_subwindows(true) newwindow.set_disable_input(false) newwindow.set_handle_input_locally(true) newwindow.set_flag(Window.FLAG_NO_FOCUS, false) newwindow.set_transient(true)

newwindow.set_world_3d(World3D.new()) newwindow.set_use_own_world_3d(true)

newwindow.set_name(nodeName) instance_map[nodeName] = newwindow

get_tree().get_root().add_child(newwindow)

worldNew.set_name(nodeName) worldNew.Init()

newwindow.add_child(worldNew) worldNew.OnGoto(data)

newwindow.set_size(get_tree().get_root().get_size()) The terrain3d node is added as a child of the node3d node, which is then a child of the newwindow node. The SimpleGrass node is then a child of the terrain3d node's scene.

please tell me if using a new window/world setup could be causing the grass to not follow the player properly.my english is not good ,sorry

When you use a new world the SimpleGrass camera cannot see the objects within that world, that is why the interactive mode does not work.