VFX Graph (Rotation Quaternion in Update Loop) - Error

I have a problem, if I pass a matrix or quaternion to the graphics buffer, then in Vfx update I get an error (as I understand, Euler angles cannot be extracted in the VFX update - everything is OK in the initialization). I have a position (vector3) and bone rotation (quaternion), muzzle effects should follow the gun barrel (offset - vector3 of the gun barrel when fired is passed to Particle in a custom property - since the weapon can have many barrels). The problem is how to work with a quaternion in the VFX update (now instead of a matrix or quaternion I throw Euler angles, calculating them on the CPU for all units every frame, instead of working with quaternions because of the VFX)?

Hi!

Yes, I’m afraid that VFX graph does not work with quaternions. But it should work fine with the transformation matrices directly, what kind of error are you getting?

Having the (euler) angles separately can be good, if you need to compute anything depending on the angle. But otherwise, try to store the matrix directly and use it to transform your particles.

Hi! This Error - like i said before - VFX cant calculate EulerAngles from Quaternion in Update on GPU (If Connect Matrix to NodeTransform and take Angles and Set it To Update Node SetAngles).
I would like to work with quaternion for performance! How can I calculate the correct offset on the GPU (without converting the quaternion to Euler Angles on the CPU) - I don’t know. And it’s not an option to create 5-30 game objects and transforms for each weapon output in the bones (extra overhead) every frame.

Unity cannot compile the VisualEffectAsset at path "Assets/VFX/AlienVFX/Bomber/BomberExplode.vfx" because of the following exception:
System.NotImplementedException: UnityEditor.VFX.VFXExpressionExtractAnglesFromMatrix
  at UnityEditor.VFX.VFXExpression.GetCodeString (System.String[] parents) [0x00000] in .\Library\PackageCache\com.unity.visualeffectgraph\Editor\Expressions\VFXExpressionAbstract.cs:407 
  at UnityEditor.VFX.VFXShaderWriter.WriteVariable (UnityEditor.VFX.VFXExpression exp, System.Collections.Generic.Dictionary`2[TKey,TValue] variableNames) [0x00079] in .\Library\PackageCache\com.unity.visualeffectgraph\Editor\Compiler\VFXShaderWriter.cs:639 
  at UnityEditor.VFX.VFXCodeGenerator.BuildBlock (UnityEditor.VFX.VFXTaskCompiledData taskData, UnityEditor.VFX.VFXShaderWriter blockFunction, UnityEditor.VFX.VFXShaderWriter blockCallFunction, System.Collections.Generic.HashSet`1[T] blockDeclared, System.Collections.Generic.Dictionary`2[TKey,TValue] expressionToName, UnityEditor.VFX.VFXBlock block, System.Int32& blockIndex) [0x001fc] in .\Library\PackageCache\com.unity.visualeffectgraph\Editor\Compiler\VFXCodeGenerator.cs:1019 
  at UnityEditor.VFX.VFXCodeGenerator.BuildContextBlocks (UnityEditor.VFX.VFXContext context, UnityEditor.VFX.VFXTaskCompiledData taskData, System.Collections.Generic.Dictionary`2[TKey,TValue] expressionToName, UnityEditor.VFX.VFXShaderWriter& blockFunction, UnityEditor.VFX.VFXShaderWriter& blockCallFunction, UnityEditor.VFX.VFXShaderWriter& blockIncludes, UnityEditor.VFX.VFXShaderWriter& blockDefines) [0x00132] in .\Library\PackageCache\com.unity.visualeffectgraph\Editor\Compiler\VFXCodeGenerator.cs:445 
  at UnityEditor.VFX.VFXCodeGenerator.Build (UnityEditor.VFX.VFXContext context, UnityEditor.VFX.VFXTask task, System.String templatePath, UnityEditor.VFX.VFXCompilationMode compilationMode, UnityEditor.VFX.VFXTaskCompiledData taskData, System.Collections.Generic.HashSet`1[T] dependencies, System.Boolean enableShaderDebugSymbols, System.Collections.Generic.List`1[System.String]& errors) [0x002c9] in .\Library\PackageCache\com.unity.visualeffectgraph\Editor\Compiler\VFXCodeGenerator.cs:722 
  at UnityEditor.VFX.VFXCodeGenerator.Build (UnityEditor.VFX.VFXContext context, UnityEditor.VFX.VFXTask task, UnityEditor.VFX.VFXCompilationMode compilationMode, UnityEditor.VFX.VFXTaskCompiledData taskData, System.Collections.Generic.HashSet`1[T] dependencies, System.Boolean forceShadeDebugSymbols, System.Collections.Generic.List`1[System.String]& errors) [0x0002e] in .\Library\PackageCache\com.unity.visualeffectgraph\Editor\Compiler\VFXCodeGenerator.cs:246 
  at UnityEditor.VFX.VFXGraphCompiledData.GenerateShaders (System.Collections.Generic.List`1[T] outGeneratedCodeData, UnityEditor.VFX.VFXExpressionGraph graph, System.Collections.Generic.IEnumerable`1[T] contexts, UnityEditor.VFX.VFXCompiledData compiledData, UnityEditor.VFX.VFXCompilationMode compilationMode, System.Collections.Generic.HashSet`1[T] dependencies, System.Boolean enableShaderDebugSymbols, System.Collections.Generic.Dictionary`2[TKey,TValue] gpuMappers) [0x000f1] in .\Library\PackageCache\com.unity.visualeffectgraph\Editor\Compiler\VFXGraphCompiledData.cs:849 
  at UnityEditor.VFX.VFXGraphCompiledData.Compile (UnityEditor.VFX.VFXCompilationMode compilationMode, System.Boolean forceShaderValidation, System.Boolean enableShaderDebugSymbols, UnityEditor.VFX.VFXAnalytics analytics) [0x006af] in .\Library\PackageCache\com.unity.visualeffectgraph\Editor\Compiler\VFXGraphCompiledData.cs:1238 
UnityEditor.EditorApplication:Internal_CallUpdateFunctions ()