[Closed] Add a point to an array
Hello
I have a loop that creates 2 points at a time, and for me to use them the way I want i need to keep them each at a different array. My code is this:
objNumber = 5
count = 1
array helper_points
for i = 1 to objNumber do (
ran = random 0.0 1.0
ran2 = ran +0.001
point_1 = point pos:(pathInterp $ 1 (ran))
point_2 = point pos:(pathInterp $ 1 (ran2))
)
I want to to append all the ‘point_1’ to an array called ‘pos_array’ and all the ‘point_2’ to an array called ‘look_array’
I tried to do this inside the for loop:
append pos_array point_1
append look_array point_2
But it didn’t work at all
You first have to create the array in order to then add items to it.
pos_array = #()
look_array = #()
append pos_array point_1
append look_array point_2
(
objNumber = 5
pos_array = #()
look_array = #()
for i = 1 to objNumber do
(
ran = random 0.0 1.0
ran2 = ran + 0.001
point_1 = point pos:(pathInterp $ 1 ran )
point_2 = point pos:(pathInterp $ 1 ran2)
append pos_array point_1
append look_array point_2
)
)
Perhaps thats what you need.
pathTangent <shape> [ <curve_num> ] <parameter>
Return the tangent direction vector at the 3ds Max Path (vertex-based) interpolated point along the specified curve.
You can use this function, for example, to set an object’s direction to follow the curve.