Maxunderground news unavailable
i am making a very simple branching script and i have a problem with rotating vectors.
here is my code:
fn branch pointOne pointTwo lne angl scaleValue =
--get the length of the input line
lineLength = curveLength lne
--conditional statement - based on length
if lineLength > 10 then
--get a vector between start and end point
theVec = pointTwo - pointOne
theVecScale = theVec*scaleValue
-- angle of rotation:
ang = acos (dot angl theVecScale.row3)
-- axis of rotation:
axis = normalize (cross angl theVecScale.row3)
theVec1 = preRotate theVecScale (quat ang axis)
theVec2 = preRotate theVecScale (quat ang axis)
--add the vector to the end point
newEndPt = theVec1 - pointTwo
newEndPt2 = theVec2 - pointTwo
--draw a new line
line1 = drawLineBetweenTwoPoints pointTwo newEndPt
line2 = drawLineBetweenTwoPoints pointTwo newEndPt2
call1 = branch pointTwo newEndPt line1 angl scaleValue
call2 = branch pointTwo newEndPt2 line2 angl scaleValue
)-- end function branch
thepoint1 = [-55.6173,12.7729,0]
thepoint2 = [47.3067,16.3203,0]
bline = drawLineBetweenTwoPoints thepoint1 thepoint2 --select a starting branch
zvector = [ 15, 1, 180]
scaleV = 0.9*[1,1,1]
theBranch = branch thepoint1 thepoint2 bline zvector scaleV
i cannot understand why max is not drawing the lines.
i would appreciate if someone could help correcting the code.
read 247 times
6/10/2011 10:35:22 PM (last edit: 6/10/2011 10:35:22 PM)
I didn't try to understand what you're doing but it seems you forgot to update the shape (see the updateShape() method in the ref).
read 241 times
6/10/2011 11:19:26 PM (last edit: 6/10/2011 11:19:26 PM)
the function DrawALineBetweenTwopoints is updating the shape inside the function.
im just trying to create two offsprings from a base line. that are scaled * 0.9 and rotated by an angle. (angle and - angle).
read 235 times
6/10/2011 11:28:16 PM (last edit: 6/11/2011 12:11:14 AM)