How to add particles to a window, volume or space in VisionOS

Oscar de la Hera Gomez
Three flowers that represent SwiftUI, RealityKit and XCode side by side. Beneath them sits the text "Particle Emitters".

For particle emitters created in Reality Composer Pro to work as expected, you must programmatically add them to the content of a RealityView.

The code for the demonstration detailed on this post can be found at the tutorials/reality-composer-pro/fire branch of our open source tutorial linked below.

A screenshot of the VisionOS simulator showing how a flame is not being rendered correctly.

The following demonstration attempts to solve the issue illustrated above, which arises if you use a Model3D to add a particle effect to a window or volume.

The issue becomes obvious when you move the window or volume and the particle doesn't behave as expected.

A screenshot of XCode showing how we programatically added the fire to a RealityView.

To solve this issue, you must programatically add the particle to the window or volume, using code similar to that above. 

This will also render it correctly within a space.

A screenshot of the VisionOS simulator showing how the particle renders correctly even after a window has been adjusted.

Looking to learn more about SwiftUI, Swift, RealityKit, Design and Technology?

Search our blog to learn more about Swift, SwiftUI, RealityKit, design and technology.

Any Questions?

We are actively looking for feedback on how to improve this resource. Please send us a note to inquiries@delasign.com with any thoughts or feedback you may have.
delasign logo

Book a Free Consultation.

An icon of an email.

Click here to email us.

Fill in the details below to book a free consultation or to let us know about something else. Whatever it is, we are here to help.

How can we help you ?

Contact Details