Zylann / godot_voxel

Voxel module for Godot Engine
MIT License
2.71k stars 251 forks source link

Adding Props to Terrain / Seeing Terrain in Editor #82

Open jedStevens opened 5 years ago

jedStevens commented 5 years ago

Hello,

To start I'd like to say thank you very much for making this repo; I was scared of having to do dual marching cubes myself so this is really helpful for my project.

My real issue is that I can't see the terrain in the editor, therefore it is hard to add props like trees and rocks to a map as you can't be sure the exact coordinates to place something at.

I'm just hoping someone could answer my two questions:

  1. Is it possible to see the terrain in the editor?
  2. If not should I be placing my props via some algorithm where I use the height data from the VoxelTerrain node?

Thanks and have a great day!

TokisanGames commented 5 years ago

I too would like the option to run the terrain in editor @Zylann . However the other pending issues regarding artifacts are much more important game stoppers, IMO.

In the meantime, it's not necessary. Run your game. Reduce the windows so both the editor and game are on screen at once. Move your objects in the inspector and they will update in the game in real-time. You can also adjust materials, camera and lights live as well.

Zylann commented 5 years ago

See my comment https://github.com/Zylann/godot_voxel/issues/80#issuecomment-541463082

TokisanGames commented 5 years ago

Gotcha

jedStevens commented 5 years ago

Sounds good. I didn't see that comment, I'll keep the repo on watch.

Thanks for all the good work

Zylann commented 4 years ago

I'm still considering adding support for terrain visibility in the editor, however I am blocked by the following problem:

If you make a custom generator using GDScript or C#, it needs to be tool in order to run in the editor. However, generation happens in a thread. If you edit your script while the editor is running, this will cause the script to reload, and two bad things will happen:

I can therefore not implement this in the editor if you have a script generator. It can be made available at your own risk, but any change to the script may cause a crash. I would need a way to know when a resource is about to be reloaded so I can suspend the thread, and resume it when it's done.

However, I can implement this for simple stock generators, and the upcoming VoxelGeneratorGraph, because these are purely data driven, so the duplication workaround works for them.

TokisanGames commented 4 years ago

What if in the editor it did not continuously generate? What if there was a button in the top menu or in the inspector to manually generate once?

Zylann commented 4 years ago

What if in the editor it did not continuously generate? What if there was a button in the top menu or in the inspector to manually generate once?

It needs to generate in the first place. That takes a while, will only center on your current position, and it's terrible UX. The editor would have to freeze for dozens of seconds (even more depending on your code) if you do it in this way. It can be made with a modal progress bar (which means the editor has to be able to run), but then you'd have to be careful not causing any reload.