I'm working on a script that will need to know which way a curve is facing, meaning if all the points on the curve share the same X value, it's facing the X direction. I have the script below that will correctly show the global space vector positions of each control point of the curve.
import bpy
obj = bpy.context.active_object
curve = obj.data
spline = curve.splines[0]
# setup array for points to be written to
pathPoints = []
# Iterate through the control points in the spline and append them to the array
for i in range(0, len(spline.bezier_points)):
pathPoints.append(obj.matrix_world @ spline.bezier_points[i].co)
# determine if path is facing X, Y, or Z
# TODO
# DEBUGGING
print(pathPoints)
global = obj.matrix_world @ local
(Use * for pre 2.8) $\endgroup$ – batFINGER Aug 18 '19 at 15:03pathPoints.append(spline.bezier_points[i].co @ obj.matrix_world)
? $\endgroup$ – Jeff Lange Aug 18 '19 at 18:50pathPoints.append(obj.matrix_world @ spline.bezier_points[i].co)
to work, but how do I determine what plane is the major plane? $\endgroup$ – Jeff Lange Aug 19 '19 at 5:01