The fsVfxSpawnInWorld function can be used to span a visual effect in the world.


FsVFXId fsVfxSpawnInWorld(
    const char* strGuid,
    FsVec3d lla,
    FsVec3d pbh = { 0, 0, 0 },
    float minEmissionTime = -1.f,
    FsVfxGraphParam* graphParams = nullptr,
    int graphParamsSize = 0


Parameters Description

The GUID guid of the vfx to spawn, as a string, for example: "7E68323C-E75D-4F5B-988E-65DD4956F6BA". This is a required parameter with no default value.

lla The Latitude, Longitude and Altitude where the VFX will be spawned in the world. This is a required parameter with no default value.
pbh The Pitch, Bank, and Heading of the VFX (in degrees). The default values are: {0, 0, 0}
minEmissionTime The time from which fsVFXIsMinTimePassed will be TRUE. Reaching this time has no other impact on the VFX, and if set to -1 then fsVFXIsMinTimePassed will be TRUE from the moment the VFX instance is spawned. The default value is: -1.f
graphParams An array of graph parameters for the VFX. The default value is: nullptr
graphParamsSize The size of the graphParams array. The default value is: 0

Return Values

The function returns a VFX ID which can be used in most of the other VFX API functions. If something has gone wrong and the function fails, FSVFXID_NULL will be returned. The VFX creation may fail if:

  • the pointer to strGuid is not valid
  • the VFX associated with the GUID is not loaded in the game (possibly because the VFX doesn't exist)
  • the VFX has been spawned to far away (ie: further than all the MaxEmissionDistance of the emmiters)


FsVec3d lla = { 36.151591, -5.340841, 58.154 };
FsVec3d pbh = { 0, 0, 0 };
FsVfxGraphParam graphParams[3];
graphParams[0].paramName = "ColorR";
graphParams[0].RPNExpression = "0";
graphParams[1].paramName = "ColorG";
graphParams[1].RPNExpression = "0";
graphParams[2].paramName = "ColorB";
graphParams[2].RPNExpression = "1";
g_SpawnVars.fxInWorldId = fsVfxSpawnInWorld("AAF9ECBE-C092-429A-877B-D41357D1E519", lla, pbh, -1, graphParams, 3);



When spawned a VFX instance will start playing automatically. Also note that all VFX that you spawn in the world should be destroyed when no longer required using the fsVfxDestroyInstance function.


See Also