Repository navigation
Conversation
When the ParticleSystemRenderer render mode is Stretched Billboard, UIParticleSystem now aligns each particle quad with the particle's total velocity and stretches it the same way Unity does: length = size * lengthScale + speed * velocityScale, width = size. The velocity is converted to the same space as the vertex positions (world simulation space is transformed to local), so stretching is correct regardless of simulation space. The existing "use length scale" option now shares this path, which also fixes the case where a particle moving exactly along +X was stretched vertically instead of along its velocity. The renderer access is now null-safe. Fixes Unity-UI-Extensions#423.
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.
Unity UI Extensions - Pull Request
Overview
Adds support for the Stretched Billboard render mode to
UIParticleSystem. Previously the component ignored theParticleSystemRendererrender mode and always drew regular billboards. The only way to get a stretched look was the_useLengthScaleoption, which ignored Speed Scale and had an axis bug.Changes
ParticleSystemRenderer.renderMode == ParticleSystemRenderMode.Stretch, each particle quad faces the particle's direction of travel. Its length follows Unity's formula,size * lengthScale + speed * velocityScale, and its width stays the particle size.Particle.totalVelocity, so the Velocity over Lifetime and Force modules are included. For world simulation space the velocity is converted into the component's local space, the same space as the vertex positions, and it gets the same Shape scaling as positions. This is done in a new private helper,GetParticleVelocity._useLengthScaleoption goes through the same code. This fixes a bug where a particle moving exactly along +X (rotation == 0) was stretched along Y instead of along its velocity.use3dRotationis skipped for particles that face their velocity, as in Unity's stretched mode.pRenderer.lengthScaleis now null-safe.Not covered: Camera Speed Scale, Freeform Stretching, and the Mesh / Horizontal / Vertical Billboard modes. These could be follow-ups.
Breaking Changes
_useLengthScalefix for particles moving exactly along +X.Related Submodule Changes
Testing status
No automated test command was detected, so tests were not run.
Manual testing status
Suggested check: put a
UIParticleSystemon a Canvas, set the Particle System Renderer to Stretched Billboard, and change Speed Scale and Length Scale with Local and World simulation space. Particles should stretch along their direction of travel, and the stretch should grow with speed.This PR was prepared with AI assistance (Claude) and reviewed by me before submitting.