Shutter rotation problem in my rulefile

153
1
2 weeks ago
JulesChasson
New Contributor

Hello !

I'm currently working on a rulefile to generate buildings from an italian town. I wanted to make the some shutters opened with different rotations, but i encountered a problem : My first shutter works perfectly fine, and rotates in the correct way, but the second one rotates from the middle of the window, and i would like it to rotate from the side of the window. Maybe it isn't very clear, so i put screenshots from the models and from my rulefile on this post.

JulesChasson_0-1714748440049.png

Same problem here...

JulesChasson_1-1714748516880.png

And here :

JulesChasson_2-1714748540420.png

And here is the screenshot of my rule where i tried to do the rotation command. As you can see, i split the "Facade__1_1_5_2_1_2", (it was the 2 shutters combined), and then i tried to use the rotate command on each one of them to create the opening effect :

JulesChasson_3-1714748570573.png

 

Thanks for the help !

Jules

0 Kudos
1 Reply
plfontes
Occasional Contributor

Hi Jules,

changing the position of the Shutter pivot will do the trick.

Facade__1_1_5_2_1_2 -->
	setupProjection(0, scope.xy, '11.0092, '3.7067, '-1.2927, '-2.2608)
	projectUV(0)
	color(shutt_color)
	split(x){~1:Shutter1 |~1: setPivot(xyz,1) Shutter2}
	
Shutter1 -->
	extrude(0.1)
	rotate(rel, world, 0, 40% : 0
						else : rand(-80,-180),0)
	
Shutter2 -->
	extrude(0.1)
	rotate(rel, world, 0, 40% : 0
						else : rand(80,180),0)

If the Shutter hinges along the wrong axis, just change the corner number in the setPivot operation.

Hope that helps.

P