Notifications
Clear all
[Closed] Change Rotate Axis
Jul 18, 2018 12:58 am
Hey. Faced such problem at cloning of objects on a spline . How to determine The y-axis that it is not directed upwards. I tried to set the matrix transform myself but there were problems in different directions.
How to make the y-axis look up always.
-- some transform object for curve
pos = interpCurve3D spline_shape[1] splineID totalPathPos -- the absolute position in world space
clones[cnt].transform = matrixFromNormal ( tangentCurve3D spline_shape[1] splineID totalPathPos )
orgScale = clones[cnt].scale -- save the original scale
- Here I tried to assign axis but it didn't work ( with different direction obtained by different )
-- sellection[1] ==== any object ib spline
-- sellection[2] ==== any point
YVec = normalize ( selection[1].transform.row3 )
ZVec = [0,0,1] --this is needed for a temporary up vector calculation
XVec = cross YVec Zvec
ZVec = cross XVec YVec
tm = orthogonalize (matrix3 XVec YVec ZVec selection[1].pos )
selection[2].transform = tm
-- and othe code for i try
sideVec = normalize ( selection[1].transform.row1)
directionVec = normalize ( selection[1].transform.row3 )
upVec = normalize ( selection[1].transform.row2 )
-- "Z"
dirUp = ((dot directionVec upVec) * -directionVec + upVec)
selection[2].transform = orthogonalize (matrix3 (cross dirUp directionVec) dirUp directionVec selection[1].pos)
2 Replies
Jul 18, 2018 12:58 am
Isn’t the YVec row2 and not row3?
row1 == X axis
row2 == Y axis
row3 == Z axis
row4 == Translation/Position
Right?