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

Update debug collision on operations #106

Closed
TokisanGames opened this issue Jul 7, 2023 · 5 comments · Fixed by #278
Closed

Update debug collision on operations #106

TokisanGames opened this issue Jul 7, 2023 · 5 comments · Fixed by #278
Assignees
Labels
enhancement New feature or request low priority Low Priority
Milestone

Comments

@TokisanGames
Copy link
Owner

When adding/removing regions, sculpting, undo/redo the debug collision shapes are not updated automatically.
Currently the user must turn _show_debug_collision off and on.

Currently updating destroys and rebuilds and takes .5-1s to update, so it's not good to update on every painting. It could update during the undo/redo setup, but that's still a bit slow.

What would be faster to mark dirty regions and only update those. It also needs to add and remove CollisionShapes as regions are added or removed.

@TokisanGames TokisanGames added enhancement New feature or request low priority Low Priority labels Jul 7, 2023
@TokisanGames TokisanGames added this to the Polished Version milestone Jul 7, 2023
@TokisanGames TokisanGames moved this to Ideas in @Terrain Jul 7, 2023
@outobugi
Copy link
Collaborator

Maybe, instead of using collision shapes, we could make a plane mesh with same structure as the collider would be and make a wireframe shader for it?

@TokisanGames
Copy link
Owner Author

That's an interesting idea. And that could work in game as well.

@matthewhilton
Copy link

matthewhilton commented Feb 22, 2024

Just some notes from my experimentation adding this (in my game the collision updates after edits in game, but it would be the same for updating in the editor)

Switched to generate 1 heightmap shape per region (instead of 1 big one covering every region). Then when edits happen, they only update the single region. (Code is here but its very very rough main...matthewhilton:Terrain3D:collision-update-improvements-090)

My game only has max 8 regions so this is OK. Might not be suitable for larger terrains.

Performance optimisation:

  • Initially I found even editing a single region took ~250ms (very bad!)
  • Downgrading godot-cpp to https://github.com/godotengine/godot-cpp/tree/631cd5fe37d4e6df6e5eb66eb4435feca12708cc (the version in Terrain3D 0.9.0), mysteriously reduced this to 60ms (there must be some kind of performance regression...)
  • I was previously using Godot-jolt. Switching to default godot physics reduced this down further to 20ms.
  • Switching the region size to 512 instead of 1024 it is now 6ms which is good enough for my project.

@TokisanGames
Copy link
Owner Author

#278 will address this.

@TokisanGames TokisanGames self-assigned this Aug 28, 2024
@TokisanGames TokisanGames modified the milestones: Future, Beta 0.9.x Aug 28, 2024
@TokisanGames TokisanGames modified the milestones: 0.9, 1.0 Oct 6, 2024
@TokisanGames TokisanGames moved this from 1.0 to In Progress in Terrain3D Roadmap Dec 31, 2024
@TokisanGames
Copy link
Owner Author

TokisanGames commented Jan 28, 2025

#278 Dynamic collision has been implemented and we need testers.

Currently dynamic collision is updated on the fly and is fast in the editor. Realtime changes are feasible.

Full mode (old static debug collision) is still slow because there's a lot of data. It does rebuild on region add/remove and some settings changes like mode. It won't update during sculpting. However the user can update it by calling update().

See #278 (comment)

@github-project-automation github-project-automation bot moved this from In Progress to Done in Terrain3D Roadmap Jan 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request low priority Low Priority
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants