PDA

View Full Version : 3ds Max accuracy or ME?

 videep03-18-2012, 06:24 PMSo what I am trying to do here is: I have a spline, I want to place 10 objects on it and want it to see another spline. so here is the code: spline1 = \$Line01 spline2 = \$Line02 cl = curveLength spline1 num = 10 numParts = (cl/10) for i = 1 to num do ( r = instance \$Rectangle01 pathParam = ((numParts*i)/cl) if pathParam <= 1 then ( r.pos = lengthInterp spline1 1 pathParam nearestPathp = nearestPathParam spline1 1 r.pos dir = pathInterp spline2 1 nearestPathp r.dir = normalize(dir-r.pos) ) ) But even if the lines are STAIGHT, there is a rotation angle in the rectangles that I am placing in Z AXIS. Should the rectangles Z rotation not be ZERO in case the lines Are STRAIGHT? Please let me know if its a max's bug or a problem in my script above. Attaching images.
3ak
03-19-2012, 04:42 AM
spline1 = \$Line01
spline2 = \$Line02

cl = curveLength spline1
num = 10
numParts = (cl/10)
for i = 1 to num do
(
r = instance \$Rectangle01
pathParam = ((numParts*i)/cl)
if pathParam <= 1 then
(
r.pos = lengthInterp spline1 1 pathParam
nearestPathp = nearestPathParam spline2 1 r.pos
dir = pathInterp spline2 1 nearestPathp
r.dir = normalize(dir-r.pos)
)
)

videep
03-19-2012, 05:44 AM
Sorry that was a TYPO by me here in this thread, you can try for yourself, making it Spline2 also does not help, in my actual code I had it "spline2".

3ak
03-19-2012, 05:55 AM
3ds max uses iterative method to find nearest point. increase "steps" parameter in nearestPathParam to lower the error. It doesn't really matter if line is straight or not.

videep
03-19-2012, 05:58 AM
what number of steps should I put in? 10,20,500?
I tried till 500 does not work!!!

3ak
03-19-2012, 06:04 AM
100 000 will lower it significally)
but you'll never get 0.
I think it's easier to zero out Z coord if it so important for you to get 0

videep
03-19-2012, 06:21 AM
Probably increasing the steps increase the time taken to place the objects on the spline.
So what I want to do exactly is to place objects on a spline and make it look at a point which is perpendicular to it, can you probably suggest me something in that case?

CGTalk Moderation
03-19-2012, 06:21 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.