Skip to content

Allow trail particles to be parented to their spawner#7528

Open
BMagnu wants to merge 17 commits into
scp-fs2open:masterfrom
BMagnu:particle_more_parents
Open

Allow trail particles to be parented to their spawner#7528
BMagnu wants to merge 17 commits into
scp-fs2open:masterfrom
BMagnu:particle_more_parents

Conversation

@BMagnu

@BMagnu BMagnu commented Jun 14, 2026

Copy link
Copy Markdown
Member

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:
performance testing

@BMagnu BMagnu added enhancement A new feature or upgrade of an existing feature to add additional functionality. particles An item related to the particle system Waiting for Stable Marks a pull request that is to be merged after the next stable release, due to a release cycle cleanup A modification or rewrite of code to make it more understandable or easier to maintain. labels Jun 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cleanup A modification or rewrite of code to make it more understandable or easier to maintain. enhancement A new feature or upgrade of an existing feature to add additional functionality. particles An item related to the particle system Waiting for Stable Marks a pull request that is to be merged after the next stable release, due to a release cycle

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant