Multiple Tile Physics Layers #32
Conversation
jbuehler23
left a comment
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
i'd keep this off by default for performance
| 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 {:?}", |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
this is a large change in the z-ordering and could cause issues
|
|
||
| use crate::{CollisionData, CollisionShape, OneWayDirection}; | ||
|
|
||
| /// Configuration for autotiling in a project |
There was a problem hiding this comment.
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) { | |||
There was a problem hiding this comment.
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
|
So I've addressed everything! still not sure how to get clippy to pass, I've tried running cargo fix |
jbuehler23
left a comment
There was a problem hiding this comment.
Looks good - let's get clippy passing and we can get this merged - you can run it locally with cargo clippy --workspace --all-targets
|
hey @SueHeir any reason for closing this? if you like, i can clean up clippy for you and get this merged in? |
|
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. |
|
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? |
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!