Notifications
Clear all

[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

7 Replies

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.

How do I apply the direction vector on an object?

1 Reply
(@polytools3d)
Joined: 11 months ago

Posts: 0
vector = [1,0,0]
<node>.dir = vector

Thank you this is great!!

Wonderful, Thank you so much

Thanks again to both of you!!

Works absolutely fantastic!