Allow trail particles to be parented to their spawner#7528
Open
BMagnu wants to merge 17 commits into
Open
Conversation
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.
This one's a little more complicated.
Prior to this, a particle that's a trail of another particle with both having local to parent set to true would transitively inherit the parent trail's parent object.
As evident, this also runs into naming ambiguity, so this PR cleans this up.
Parent, as in the thing that spawned a particle, is (and really was already) called "Host". A spawner tracks its host, gets its position and other data for curves.
Parent, as in the thing that a particle uses as frame of reference for local coordinates, is now called an Attachment. Attachments provide a frame of reference, and functions to convert local and global coordinates, no matter what they actually are (currently can be either nothing, an object, or a particle).
In order to get around the prior behavior of transitive attachments by default, this adds a table option to selectively disable transitivity. If that is set to true, a child particle will not inherit the underlying object attachment, but the particle as an attachment.
This allows more complex particle trail chains, some of which have been shown to be necessary for certain type of explosion effects actually encountered during modding.
It also cleans up the code by moving a fair bit of ad-hoc checks and coordinate space conversions into their own dedicated functions
The added indirection through the variant does cost some performance, but IMO it stays in an acceptable cost frame.

The following is a testing mission with 300k particles and nothing else: