You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey there. I want to use ProtonScatter for procedurally generated worlds on runtime, so using the editor tool is a no-go. After reading the code a bit, I tried my hand at creating both a base node and modifiers in a script:
# class preloadingconstProtonScatter:=preload("res://addons/proton_scatter/src/scatter.gd")
constClusterizeModifier:=preload("res://addons/proton_scatter/src/modifiers/clusterize.gd")
constProjectModifier:=preload("res://addons/proton_scatter/src/modifiers/project_on_geometry.gd")
constRelaxModifier:=preload("res://addons/proton_scatter/src/modifiers/relax.gd")
constRandomizeTransformModifier:=preload("res://addons/proton_scatter/src/modifiers/randomize_transforms.gd")
constCreateInsideRandomModifier:=preload("res://addons/proton_scatter/src/modifiers/create_inside_random.gd")
constProtonScatterItem:=preload("res://addons/proton_scatter/src/scatter_item.gd")
constProtonScatterShape:=preload("res://addons/proton_scatter/src/scatter_shape.gd")
funcready:
# create base node and stackvarnode: ProtonScatter=ProtonScatter.new()
varstack=node.ProtonScatterModifierStack.new()
# create modifiervarclusterize_modifier:=ClusterizeModifier.new()
varproject_modifier:=ProjectModifier.new()
varrelax_modifier:=RelaxModifier.new()
varrandomize_modifier:=RandomizeTransformModifier.new()
varcreate_inside_modifier:=CreateInsideRandomModifier.new()
# add modifiers to stack in same order as editor - supposing that clusterize is the last modifierstack.add(create_inside_modifier)
stack.add(randomize_modifier)
stack.add(relax_modifier)
stack.add(project_modifier)
stack.add(clusterize_modifier)
# replicate tree structure - shape and itemvaritem_node:=ProtonScatterItem.new()
varshape_node:=ProtonScatterShape.new()
node.add_child(item_node)
node.add_child(shape_node)
# assign stacknode.modifier_stack=stack
Bear in mind I excluded most parameters when creating new modifiers as the script would get too long for this post.
So my question is: am I doing it right? I'm not getting the same results than when using the node in the editor - the game gets stuck or doesn't apply the transformations right. There is no documentation about this so I feel like I'm beating around the bush.
Thanks
The text was updated successfully, but these errors were encountered:
I've been working on a procedural generation project with a similar need. I'm not sure if this works for your use case, but I have found success with this strategy:
Create a scene that contains a ProtonScatter node. Configure it in-editor.
Generate your terrain as normal at runtime.
Call $ProtonScatter.rebuild.call_deferred() for Scatter to pick up any changes.
A hacky example can be found here, using Godot 4.1.3. I've found that this doesn't work for me when I place the 3D scene in a Viewport, but I still need to look into why.
Hey there. I want to use ProtonScatter for procedurally generated worlds on runtime, so using the editor tool is a no-go. After reading the code a bit, I tried my hand at creating both a base node and modifiers in a script:
Bear in mind I excluded most parameters when creating new modifiers as the script would get too long for this post.
So my question is: am I doing it right? I'm not getting the same results than when using the node in the editor - the game gets stuck or doesn't apply the transformations right. There is no documentation about this so I feel like I'm beating around the bush.
Thanks
The text was updated successfully, but these errors were encountered: