| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
📝 Walkthrough
WalkthroughThe changes introduce a new ConvexHullMeshCollider component for convex hull-based collisions, convert MeshCollider to handle triangle meshes with active-edge thresholding, and update RigidBodySystem to support both collision shape creation paths with scaling. Changes
Sequence Diagram(s)sequenceDiagram
participant RBS as RigidBodySystem
participant Transform
participant CCH as ConvexHullMeshCollider
participant Mesh as Mesh Component
participant JPH as Jolt Physics
participant MeshCollider
RBS->>RBS: CreateShapeFromColliders
alt ConvexHullMeshCollider present
RBS->>Transform: Extract scale
RBS->>CCH: Access maxConvexRadius
RBS->>Mesh: Get vertices & indices
RBS->>RBS: CreateConvexHullFromMesh(mesh, collider, scale)
RBS->>JPH: Build convex hull shape
JPH-->>RBS: Shape reference
else Use MeshCollider path
RBS->>Transform: Extract scale
RBS->>Mesh: Get vertices & indices
RBS->>MeshCollider: Access activeEdgeCosThresholdAngle
RBS->>RBS: CreateMeshShapeFromMesh(mesh, collider, scale)
RBS->>JPH: Build triangle mesh shape
JPH-->>RBS: Shape reference
end
RBS-->>RBS: Return Shape
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~30 minutes Possibly related PRs
Suggested labelsenhancement Suggested reviewers
Poem🚥 Pre-merge checks | ✅ 3 ✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. ❤️ ShareComment @coderabbitai help to get the list of available commands and usage tips. |
Sorry, something went wrong.
|
Sorry, something went wrong.
There was a problem hiding this comment.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)src/plugin/physics/src/component/MeshCollider.hpp (1)src/plugin/physics/src/system/RigidBodySystem.cpp (1)13-22: File header documentation is outdated.
The file header still references "Convex hull mesh collider" and "ConvexHullShape," but the component has been changed to a triangle mesh collider. This creates confusion with the actual struct documentation at lines 29-42.
📝 Proposed fix for documentation* `@file` MeshCollider.hpp - * `@brief` Convex hull mesh collider component + * `@brief` Triangle mesh collider component * - * This component creates a convex hull collision shape from the - * entity's Object::Mesh vertices using Jolt's ConvexHullShape. + * This component creates a triangle mesh collision shape from the + * entity's Object::Mesh vertices and indices using Jolt's MeshShape. *138-145: Update documentation to reflect new collider priority.
The priority order documentation doesn't mention ConvexHullMeshCollider, which is now checked before MeshCollider (at lines 188-204).
📝 Proposed documentation fix* `@note` Priority order when multiple colliders exist: * 1. SphereCollider * 2. CapsuleCollider * 3. BoxCollider - * 4. MeshCollider (requires Object::Mesh component) + * 4. ConvexHullMeshCollider (requires Object::Mesh component) + * 5. MeshCollider (requires Object::Mesh component) * - * `@note` If no collider is found, it will default to the MeshCollider with default settings, which can be pretty heavy. + * `@note` If no explicit collider is found, it will default to the MeshCollider with default settings, which can be heavy. * Make sure to always use the most appropriate colliders for RigidBodies.
src/plugin/physics/src/system/RigidBodySystem.cpp (1)106-115: Consider logging a warning for incomplete triangle data.
If indices.size() is not a multiple of 3, the trailing indices are silently ignored. This could indicate corrupted mesh data that users might want to be informed about.
💡 Suggested improvementJPH::IndexedTriangleList joltTriangles; joltTriangles.reserve(indices.size() / 3); + if (indices.size() % 3 != 0) + { + Log::Warn("MeshCollider: Indices count is not a multiple of 3, some indices will be ignored"); + } + for (size_t i = 0; i < indices.size(); i += 3) { - if (i + 2 >= indices.size()) - break; - joltTriangles.push_back(JPH::IndexedTriangle(indices[i], indices[i + 1], indices[i + 2], 0)); }
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Not related to any issues
Allow for either a full mesh or convex hull shape collider
Summary by CodeRabbit
New Features
Refactor
✏️ Tip: You can customize this high-level summary in your review settings.