Collision mesh building - #625
Open
IsaacLic wants to merge 5 commits into
Open
Conversation
# Conflicts: # engine/src/main/java/org/destinationsol/asteroids/systems/AsteroidBodyCreationSystem.java # engine/src/main/java/org/destinationsol/rubble/systems/RubbleCreationSystem.java
Follow-up fixes to the merged collision mesh builder work, needed because develop has moved on since the original change was written. * CollisionMeshBuilderSystem used @in field injection for World and EntitySystemManager. EventReceiverServiceRegistry now hands every EventReceiver to the gestalt DI container, which only populates @Inject members and never touches @in fields, so both would have been null at runtime. Switch to @Inject with an @Inject constructor and resolve the World lazily via ObjectManager.getWorld(), matching the pattern the other body creation systems use. * Delete RubbleMesh and RubbleBodyCreationSystem, which were added to develop after this work was written. Rubble now carries BodyLinked, so keeping them would have built two physics bodies per rubble piece. Removing the per-type body systems is the point of this change. The fixture density they hardcoded is preserved on the RenderableElement. * Accumulate every rigid body of a collision mesh file into one cached model instead of replacing the cache entry per rigid body, which left only the last entry of the file usable. * Compute the graphics offset as origin - (.5, .5), as the surrounding comment describes. RenderingSystem already scales the offset by the entity size, so scaling it here applied the size twice and skipped the centering correction. Co-authored-by: IsaacLic <IsaacLic@users.noreply.github.com> Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
Important Review skippedToo many files! This PR contains 424 files, which is 324 over the limit of 100. To get a review, reduce the PR to 100 files or fewer by splitting it into smaller PRs or changing its base branch. Upgrade to a paid plan to raise the limit. Usage-priced reviews support at most 300 files. ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (8)
📒 Files selected for processing (424)
You can disable this status message by setting the 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. Comment |
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.
Description
This PR generifies collision mesh creation. Rather than needing to create a separate system for each type of
Bodywith a new instance ofCollisionMeshLoader, the newCollisionMeshBuilderSystemhandles allBodycreation.The
BodyLinkedcomponent has two new fields - one for the JSON path to the mesh data, and another for the schema file that details how the data is laid out. When an entity has aBodyLinkedcomponent, the system will build aBodyusing the mesh data when it receives aGenerateBodyEvent(which will happen at the next tick).Testing
Shoot the testing asteroid (the golden asteroid visible on startup). The projectile should still collide with it, so the asteroid should be destroyed. Then try flying into the rubble. The ship should not pass through the rubble.