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

Particles object position

Discussion in 'Shaders' started by Phantom_X, Jun 16, 2021.

  1. Phantom_X

    Phantom_X

    Joined:
    Jul 11, 2013
    Posts:
    313
    Hi,
    I'm trying to get the pixel / vertex position in local space of a mesh particle.
    Using URP's shadergraph the node object position doesn't give me what I want when placed on mesh particles. It looks like it's giving me the world position instead.

    anyone knows how to do that?
     
    Mas4loo likes this.
  2. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,329
    Particle meshes are always batched meshes. Batched meshes are always pre-transformed into world space. So the “local space” for a particle system vertex is the world space position.

    The only way to get the “local” position in relation to the particle system’s transform is use a c# script to set the world to local matrix you want to use.
     
    nislgames and Mas4loo like this.