-
Notifications
You must be signed in to change notification settings - Fork 81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Convert to gridmap #12
base: development
Are you sure you want to change the base?
Convert to gridmap #12
Conversation
With this change in setting, users can edit this project regardless of whether their GPU can run Vulcan.
This ensures the tiles can be seen over the gridmap.
hi, pls check review before merging.
everything else lgtm, awesome work |
for c in $GridMap.get_used_cells(): | ||
var item = $GridMap.get_cell_item(c) | ||
|
||
var mesh | ||
if item in items_using_tiles: | ||
mesh = pksc_tile.instantiate() | ||
elif item in items_using_slopes: | ||
mesh = pksc_slope.instantiate() | ||
mesh.set_basis($GridMap.get_cell_item_basis(c)) | ||
|
||
if mesh: | ||
$Tiles.add_child(mesh) | ||
mesh.set_position($GridMap.map_to_local(c)) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this part kinda bothers me. is it not posible to use https://docs.godotengine.org/en/stable/classes/class_gridmap.html#class-gridmap-method-get-meshes ? -- something like: mesh = $GridMap.get_meshes()[c]
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know how to narrow it down further to a specific surface, for GridMap
items that also have walls and not just a floor.
In hindsight, this happens because I modeled them in blender, which does not give me control over the order of faces. Had I scripted in meshes in Godot, I could at least control which surface to create in order.
I'll like to see whether I could script the grid items generation first before fixing this pr.
This PR makes use of GridMap in creating an area.
Also, for every cell in GridMap, a mesh is generated, then added as a child of Node3D "Tiles". After all meshes are added, they are converted to static bodies accordingly.
Would have resolved #11, but it might be in the way of your refactoring. Nonetheless, this demonstrates what using GridMaps to design a level would be like.