Forum Groups
  All forums
    Help & Feedback
      Work in progress
      Finished Art
      Non-Max related

Featured Threads
  inspiration alert!!!
(37 replies)
  Indespensible MaxScripts, Plugins and 3rd Party Tools
(37 replies)
  The allmighty FREE Resources Thread !
(17 replies)
  spam alert!!!
(4886 replies)
  Maxforums member photo gallery index
(114 replies)
  Maxforums Member Tutorials
(89 replies)
  three cheers to maxforums...
(240 replies)
  101 Things you didnt know in Max...
(198 replies)
  A Face tutorial from MDB101 :D
(95 replies) Members Gallery
(516 replies)
(637 replies)
  Dub's Maxscript Tutorial Index
(119 replies)

Maxunderground news unavailable

rotation problem
show user profile  aca88

i am making a very simple branching script and i have a problem with rotating vectors.
here is my code:

--function branch
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

--scale vector
theVecScale = theVec*scaleValue

--rotate vectors
-- 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 if
)-- 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.

thank you.
read 247 times
6/10/2011 10:35:22 PM (last edit: 6/10/2011 10:35:22 PM)
show user profile  Garp
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)
show user profile  aca88
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)
#Maxforums IRC
Open chat window