Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We are updating our Terms of Service for all Unity subscription plans, effective October 13, 2022, to create a more streamlined, user-friendly set of terms. Please review them here:
    Dismiss Notice
  3. Have a look at our Games Focus blog post series which will show what Unity is doing for all game developers – now, next year, and in the future.
    Dismiss Notice

Question Skinned Mesh Sampling, position offset

Discussion in 'Visual Effect Graph' started by Kimproductions, May 13, 2022.

  1. Kimproductions


    Feb 28, 2018
    I decided to make my own post since I still couldn't figure it out. I was following this post on skinned mesh sampling with the VFX graph in URP.

    Everything works great except that I need the VFX to be a child of the RobotKyle gameobject so I can spawn it around the world, destroy it, etc.

    However, whenever I move it into Robot Kyle's hierarchy, the position is offset in a strange way.

    I assume this is because the VFX graph is also using it's own position when using the setposition node so it's kind of doubling the position.

    Is there any way to parent the VFX graph to Robot Kyle without causing this offset?

    What I've tried:
    I have tried to subtract the object's position right before the setposition node, which works for the position, except the rotation doesn't follow, but I don't know how to subtract rotation.

    Thank you,

  2. PaulDemeulenaere


    Unity Technologies

    Sep 29, 2016

    If I understand correctly, your VFX system is in Local space and the Visual Effect component belongs to the Skinned Mesh Hierarchy, your are also applying the transform through the VFX Property Binder.

    Thus, what you are observing is the translation of the root bone applied twice.
    You have to choose between these two workarounds, either:
    - Remove the Transform from Position Binder
    - Move the visual effect component back in root hierarchy

    If you look back at this sample the chosen solution was to have the Visual Effect Component in root hierarchy.
    If you need the VFX to be a child of the RobotKyle gameobject", then, it's probably more convenient to move the the VFX (assuming the system is still in Local Space) as child of the root bone (named ribs) insuring the VisualEffect component transform is identity.

    We are aware this workflow isn't ideal, we are improving this feature in 2022.2.a14 (not yet available), here an early preview (it explains the new settings field with Position Mesh in my previous screenshot):
    The Position Mesh & Sample Mesh operator will directly include an option to integrate the root bone transform. You can also compose with an additional transform.

    More information and documentation will soon be available.
    Last edited: May 13, 2022
  3. Kimproductions


    Feb 28, 2018

    Wow that worked!!! Thank you so much! I've been working on this problem for over 40 hours and it was as simple as putting the particles under the root bone and turning off the VFX binder. Additionally, since I wanted the particles to trail off in world space, I moved the position nodes into initialize particle and changed it to world space.

    Thank you once again, you're a life saver.