Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question Using Visual Effect Parent Velocity

Discussion in 'Visual Effect Graph' started by JG-Denver, Mar 16, 2023.

  1. JG-Denver

    JG-Denver

    Joined:
    Jan 4, 2013
    Posts:
    77
    I want to be able to use the velocity of the change of position of a Visual Effect's Game Object parent from the previous update. In my case, I am using 12.1 and I want to use this for color selection based on the velocity.

    I have tried using the difference and length of the attributes position and oldPosition, but oldPosition always seems to be the origin.

    I have tried the following from another post, but it doesn't work for me, just seems to get distance from the world origin:
    https://forum.unity.com/threads/spa...bject-is-moving-forward.1345934/#post-8497382

    Old position lists as being deprecated in the 12.1 specification and I am worried about relying on this. Is there a replacement for oldPosition?

    Is there a better way to do this within the Virtual Effects Graph?

    I think there may be a more complex way to do this with using particles that don't display but update and then spawn another system or have to track velocity in code and pass it as a parameter but I would like the most succinct solution.

    Any help would be greatly appreciated!