Solved 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.
op.GetDeformCache().GetPoint(231)

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:
https://www.dropbox.com/s/kwy0cf7y2sfoubm/c4d098_deform_points.png?dl=0

There are existing threads, but for some reason, the answers are not conclusive:
https://plugincafe.maxon.net/topic/6566/7105_world-coord-of-points-of-deformed-object
https://plugincafe.maxon.net/topic/9041/11999_getting-deformed-points

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
  

Cheers
Manuel

MAXON SDK Specialist

MAXON Registered Developer

@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! :)