2024-08-23 04:28 PM - edited 2024-08-23 04:30 PM
Hello everyone!
I have a quite complex object where I had hotspots controlling height, which behaved weirdly. I tried to make a new, much simpler object, and I still have the same problem, and I can't figure out why.
My hotspots are supposed to be in the corners of the object och every level, but they keep jumping in the Z direction, and I can't see a pattern of it. Can anyone figure out why? It's really annoying me.
!3D SCRIPT
DIM shape[][]
shape[1][1]=0
shape[2][1]=0
shape[3][1]=15
shape[1][2]=A
shape[2][2]=0
shape[3][2]=15
shape[1][3]=A
shape[2][3]=B
shape[3][3]=15
shape[1][4]=0
shape[2][4]=B
shape[3][4]=15
shape[1][5]=0
shape[2][5]=0
shape[3][5]=-1
FOR i=1 TO 5
PUT shape[1][i], shape[2][i], shape[3][i]
NEXT i
FOR i=1 TO num_stories
PRISM_ 5, story_height[i],
USE(NSP)
ADDZ story_height[i]
NEXT i
DEL num_stories
unID=0
FOR i=1 TO num_stories
current_height=0
FOR j=1 TO i
current_height=current_height+story_height[i]
NEXT j
FOR k=1 TO 4
!Story height hotspots
unID=unID+1 : HOTSPOT shape[1][k], shape[2][k], current_height-story_height[i], unID, story_height[i], 1 + 128
unID=unID+1 : HOTSPOT shape[1][k], shape[2][k], current_height, unID, story_height[i], 2
unID=unID+1 : HOTSPOT shape[1][k], shape[2][k], -1, unID, story_height[i], 3
NEXT k
NEXT i
My only parameters are the standard A and B for the size, story_height (an array of lengths) and num_stories (an integer between 1-10)
Thank you!
/Kaj
Solved! Go to Solution.
2024-08-23 04:32 PM
Because in your last for loop you are doing another one, this is unnecessary.
So the `current_height = current_height+story_height[i]` can run in the main loop (which already runs over all stories...).
2024-08-23 04:32 PM
Because in your last for loop you are doing another one, this is unnecessary.
So the `current_height = current_height+story_height[i]` can run in the main loop (which already runs over all stories...).
2024-08-23 04:37 PM
Oh. Bah. That was embarrassingly simple, I don't even know why I though I needed to complicate it like that. Thank you so much!