Skip to content
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

Open
wants to merge 6 commits into
base: development
Choose a base branch
from

Conversation

mechPenSketch
Copy link

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.

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.
@ramaureirac
Copy link
Owner

hi, pls check review before merging.

  1. consider creating different tscn and gd files for grid solution, i still want to offer old system as an alternative
  2. using indicator for tile and slopes doesn't seem very clean imo, is it posible to clone mesh of cell position? -- consider a map where a terrain can contain different tilt angles.
  3. imo blend and mesh_library folders should be combined in one single folder as part of a same package, for instance: blend/my_sample_map. that way users can put new libraries in same folder like blend/my_new_lib
  4. pls add documentation on how maps should be created using mesh libraries
  5. pls move slope_meshindicator.gd into src or src/tools

everything else lgtm, awesome work
btw, i think i will move this into a feature branch while i complete refactor (no e.t.a.)

Comment on lines +54 to +67
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))

Copy link
Owner

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] ?

Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[SUGGESTION] Use GridMaps for Arena
2 participants