From this (rather good!) tutorial
I need this in a 2D setting, theres a few people asking in the comments, but no ones filled in any clues....
Im guessing its changing this align function
func alignwithy(xform, newy):
xform.basis.y = newy
xform.basis.x = -xform.basis.z.cross(new_y)
xform.basis = xform.basis.orthonormalized()
but not sure how to approach it, 'basis' is for xyz, is it transform2D to use here (for xy)? Not sure that cross product is relevant here for 2D either!!
Thanks in advance!