Skip to content

Multiple Tile Physics Layers #32

Closed
SueHeir wants to merge 26 commits into
jbuehler23:mainfrom
SueHeir:main
Closed

Multiple Tile Physics Layers #32
SueHeir wants to merge 26 commits into
jbuehler23:mainfrom
SueHeir:main

Conversation

@SueHeir
Copy link
Copy Markdown
Contributor

@SueHeir SueHeir commented Feb 4, 2026

These code changes move the collider data from tile properties to its own variable in the struct to allow storing multiple layers with different masks and layer filters. The editor and mapruntime have been updated to use this new feature.

Also, I changed the z-indexing between tilemap layers for personal reasons. If you think this should be a setting or changed back, let me know!

Copy link
Copy Markdown
Owner

@jbuehler23 jbuehler23 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it would be really nice to have the ability to delete physics layers too, but really nice separation with the PhysicsLayerSet and like the usage of debug_color to show the different layers. there's just some style issues that i think cargo clippy will help resolve

tool_mode: ToolMode::Point,
show_grid: true,
show_collisions: false,
show_collisions: true,
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'd keep this off by default for performance

Comment thread crates/bevy_map_core/src/tileset.rs Outdated
if let Some(physics_layer_set) = self.physics_layers.get_physics_layer_mut(physics_layer) {
physics_layer_set.tile_physics.insert(tile_index, collision);
println!(
"set tile {} collision for physics layer {:?}",
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you remove the logging pls


// Z-offset slightly above regular tiles in same layer
let layer_z = layer_index as f32 * 0.1 + image_index as f32 * 0.01 + 0.001;
let layer_z = layer_index as f32 * 10.0 + image_index as f32 * 0.01 + 0.001;
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a large change in the z-ordering and could cause issues


use crate::{CollisionData, CollisionShape, OneWayDirection};

/// Configuration for autotiling in a project
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems like a copy/paste error here in the docs :)

@@ -2496,8 +2613,14 @@ fn handle_collision_canvas_input(
points: polygon_points.clone(),
};
if let Some(tileset) = project.tilesets.iter_mut().find(|t| t.id == tileset_id) {
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the physics_layer_id is already extracted with an early return at the start of the function here, but then checked again. i would just that variable and simplify this code

@SueHeir
Copy link
Copy Markdown
Contributor Author

SueHeir commented Feb 9, 2026

So I've addressed everything! still not sure how to get clippy to pass, I've tried running cargo fix

Copy link
Copy Markdown
Owner

@jbuehler23 jbuehler23 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good - let's get clippy passing and we can get this merged - you can run it locally with cargo clippy --workspace --all-targets

@SueHeir SueHeir closed this Feb 17, 2026
@jbuehler23
Copy link
Copy Markdown
Owner

hey @SueHeir any reason for closing this? if you like, i can clean up clippy for you and get this merged in?

@SueHeir
Copy link
Copy Markdown
Contributor Author

SueHeir commented Feb 17, 2026

TLDR: I was adding a feature that I didn't think you would want and didn't want it to show up here.

I'm making a multiplayer game where single player is secretly just a client and the server is spawned in a different thread, and because of these I needed to be able to disable the renderer via a boolean in code. (It cant be a toml feature flag because my client needs the renderer feature, and the client and server are the same executable). I was being lazy and got an AI to make the needed changes and didn't want that apart of the PR.

@jbuehler23
Copy link
Copy Markdown
Owner

I think we should still have these changes, as the ability to use multiple collisions layers configured is quite useful. Is the problem that your changes are on this branch now? You could cherrypick these changes into a separate, clean branch and reopen the PR that way?

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.

2 participants