Closed
Conversation
ThierryBerger
commented
Mar 14, 2025
ThierryBerger
commented
Mar 14, 2025
ThierryBerger
commented
Mar 14, 2025
Closed
ThierryBerger
commented
Mar 18, 2025
Comment on lines
+25
to
+28
| device: RenderDevice, | ||
| app_state: &mut AppState, | ||
| _callbacks: &mut Callbacks, | ||
| ) -> PhysicsContext { |
Contributor
Author
There was a problem hiding this comment.
examples function signature was changed to be slightly less bevy-specific, the device is still a bevy struct ; and the other parameters implement resource though 🤔
Comment on lines
+80
to
+109
| // NOTE: Heightfield may be more efficient or more predictable than trimesh for the knife. | ||
| let heights = nalgebra::DMatrix::zeros(10, 5); | ||
| let heightfield = rapier3d::prelude::HeightField::new(heights, vector![2.0, 1.0, 10.0]); | ||
| let (mut vtx, idx) = heightfield.to_trimesh(); | ||
| vtx.iter_mut().for_each(|pt| { | ||
| *pt = Isometry3::rotation(vector![0f32, 0f32, -90f32.to_radians()]) * *pt | ||
| + vector![0.0, 1f32, 0f32] | ||
| }); | ||
| let co = ColliderBuilder::trimesh(vtx, idx).unwrap(); | ||
| rapier_data | ||
| .colliders | ||
| .insert_with_parent(co, parent_handle, &mut rapier_data.bodies); | ||
| */ | ||
| for (vertices, indices) in slicer_trimeshes.iter() { | ||
| // Insert collider into rapier state. | ||
|
|
||
| let collider = ColliderBuilder::new( | ||
| SharedShape::trimesh_with_flags( | ||
| vertices.clone(), | ||
| indices | ||
| .chunks_exact(3) | ||
| .map(|i| [i[0] as u32, i[1] as u32, i[2] as u32]) | ||
| .collect(), | ||
| TriMeshFlags::FIX_INTERNAL_EDGES, | ||
| ) | ||
| .unwrap(), | ||
| ); | ||
| rapier_data | ||
| .colliders | ||
| .insert_with_parent(collider, parent_handle, &mut rapier_data.bodies); |
Contributor
Author
There was a problem hiding this comment.
I'm not sure what's the preferred behaviour there, using a model for collision is interesting, using a heightmap will probably be more stable (but it should probably be a quad if we're after simplicity)
| let y_pos = 1.3; | ||
| let z_pos = -1.5; | ||
| let velocity = 0.9; | ||
| let extended_width = 0.15; // extended width for the horizontal move to the right |
Contributor
Author
There was a problem hiding this comment.
I tried to keep the code similar to the taichi implementation, with adapted values above to fit the models used.
I added "extended_width" to have additional room for the banana slices to split more correctly (otherwise they have a tendency to stick together)
49a074a to
c7fe2b3
Compare
ThierryBerger
commented
Mar 21, 2025
Comment on lines
+1
to
+5
| # Notes | ||
|
|
||
| banana example: | ||
|
|
||
| - oneway+dynamic coupling makes the knife going places (bouncing weirdly). |
This was referenced Apr 7, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds an example based on taichi mpm demo, cutting a banana ; it also features a particle coloring based on closest vertex's color
Screencast.from.03-11-2025.03_52_13.PM.mp4
Screencast.from.03-12-2025.01_04_04.PM.mp4
other PRs are based on this one: