Get Deformed Points from Skin Deformer

  • Hi,

    I'm trying to get the deformed points from an object with a skin deformer using this code.

    The code above is different from just the GetPoint only but it does not correspond with the world position.

    You can see the illustration of the problem here:

    There are existing threads, but for some reason, the answers are not conclusive:

    Is there a way around this?

    Thank you for looking at my problem

  • hello,

    The points are stored in a local space (local coordinates). To get the global space (world coordinates) you have to multiply by the object's matrix.

    there's an example in c++

    To go from global to local, just multiply by the invert matrix

        #Retrieves the active Object
        node = doc.GetActiveObject()
        if node == None:
            raise ValueError ("there's no object selected")
        #Retrieves the deformed cache
        cache = node.GetDeformCache()
        if cache == None:
            raise ValueError("no cache found")
        #Retrieves All points    
        points = cache.GetAllPoints()
        #Retrieves the object Matrix to go from Object to world coordinates(local to global)
        opMg = node.GetMg()
        # Prints out points in local coordinates.
        print points
        # Transforms points to global coordinates
        points = [p * opMg for p in points]
        # Prints points in global coordinates.
        print points
        # Global to local
        # Retrieves the inverse Matrix of the object with ~
        invOpMg = ~opMg
        # Multiplies each point by the inverse matrix
        points = [p * invOpMg for p in points]
        print points


  • @m_magalhaes

    Thank you for the explanation:
    "The points are stored in a local space (local coordinates)."

    Printing the three version of points space was really helpful

    The code works as expected! :)

Log in to reply