SplinePoint coordinates to world coordinates

Hi there,

Im having a hard time converting local SplinePoint coordinates to world coordinates.

obj = bpy.context.active_object
objMatrix = obj.matrix_world
objData = obj.data
for s in objData.splines:
    print("--------------")
    print(s)
    for p in s.points:
        p1 = (objMatrix @ p.co) * 1000
        print(p1)

This outputs always the same data no matter where I move the curve object in space.

<bpy_struct, Spline at 0x0000022DB3E3A9F8>
<Vector (-20.6899, 7.3388, 5.0000, 0.0000)>
<Vector (-30.1720, -1.2134, 5.0000, 0.0000)>
<Vector (-30.9369, -7.0943, 5.0000, 0.0000)>
<Vector (-27.0778, -20.1056, 5.0000, 0.0000)>
<Vector (-10.7941, -28.8759, 5.0000, 0.0000)>
<Vector (0.9766, -24.5403, 5.0000, 0.0000)>
<Vector (6.5143, -16.2587, 5.0000, 0.0000)>
<Vector (6.7321, -10.8450, 5.0000, 0.0000)>
<Vector (3.6055, -0.0413, 5.0000, 0.0000)>
<Vector (-8.8957, 7.8574, 5.0000, 0.0000)>

Since Im multiplying this with the object matrix it should output the global coordinates of the point right?
What am Im doing wrong?

Thanks in advance!

If anybody else got this problem this is the solution:

import bpy
from mathutils import Vector

obj = bpy.context.active_object
objMatrix = obj.matrix_world
objData = obj.data
for s in objData.splines:
    print("--------------")
    print(s)
    for p in s.points:
        p_coords = Vector(p.co[0:3])
        p1 = (objMatrix @ p_coords) * 1000
        print(p1)

The crucial part is:

 p_coords = Vector(p.co[0:3])

Thanks anyway :slight_smile: