I have rain and wind effects in a vfx graph system. They spawn around my player, and they keep falling in world space.
So far, so good.
However, I’m using a streaming solution that contains a floating point error fix. Basically, everytime I move by more than 1000 meters, the world gets moved around my player so that it now sits in world space (0,0,0).
When that happens, the particles that were alive are now at their true position, so not around (0,0,0) anymore. New particles are spawned correctly, but the ones that were alive look like they were teleported 1000 meters away.
How do I fix that? I can call a function when my world gets moved, but I don’t know what to do to move the particles when my world gets translated around my player.
What you need is to set the simulation space for your Visual Effect Graphs to be according to another empty object. That object and the effects should get translated with the floating point fix system (or floating origin) every 1000m, and all the alive particles should move appropriately with it. The same thing is achieved in the Shuriken particle system when you set “Custom” as the simulation space and designate the transform there.
One of the Visual Effect Graph devs kindly put up a sample which is downloadable at the bottom of the following post:
Perhaps you can make it as a reusable sub graph for all your effects.
This is a frequently asked question here, because floating origin is a common workaround for floating point problems. While I’m thankful that there’s a way to achieve it, I really wish @VladVNeykov would consider adding this custom space functionality into VFX Graph natively, along with World and Local space, hopefully sooner rather than later.
Hi, sorry for necro and my english. But, this is wrong way to do FOS.
For example, i have a “dust” vfx that spawns flying particles around the camera.
I have an empty game object (at 0,0,0 and name it “VFXcenter”) with VFX
I binded VFX “Custom space” to it transform. (as shown in example post above)
Then everything shifts. (camera to center 0,0,0 and VFXCenter to delta)
And everything worked well, old particles moved, and new ones appeared in a new position.
But if the VFXcenter is far off center, a floating point error occurs.
so we are need something different for this.
something like void VisualEffect.ShiftSpawnedParticles( Vector3 delta ), or somekind event…
Just FYI, there is a Tile/Warp Particles block in the VFX Graph which is great for environmental-type effects like rain and snow as it will “teleport” particles which leave the bounds seamlessly on one side to the opposite side to create the illusion of an infinite effect.
Depending on the setup this might or might not work in your cases, just thought it might be worth mentioning.