[Closed] Louvers Scripts
Maxscript friends and family,
I have a question about the best way to do something in max. Here is what I need to do, and I’m sure there are a few ways to do it.
On a building I have there are Louvers
Think of them as blinds.
In my scene I also have a sun. I want the louvers to always be perpendicular to the sun’s vector. (So they always block the light when the sun is facing them, but are open when the sun isn’t)
To accomplish this, I’ve tried wire parameters, which didn’t seem to get me too far, I also tried a callback, which worked better because I was able to constrain the rotation of the louver to it’s X axis only, think of the solution to this being a lookAt constraint where the movement is constrained only to the X axis.
I was able to get the normal of the louver by doing a
polyOp.getFaceNormal $louver 1
but I have not been able to figure out how to get the sun’s normal, how do I get this?
Can anyone point me in the correct direction?
Many Thanks,
Colin
Unless I misunderstand the problem, you could do this with a point helper and a lookAt constraint; you don’t really need any scripting for this.
Align a point helper to the sun object and parent it to the sun. Use the lookAt constraint on the point helper with the louvers.
Then all you need to do is offset the point helper if the sun is down. You could even set up a position script constraint on the point to offset to a value if it moves past a certain point.
Why not just use Reaction Manager? Set it with the sun at the lowest most point and highest most point. Then in the states set the angle of the louvers. As always there is more than one way to achieve similar outcomes.
-Eric
Link the louvres to a dummy. The dummy gets a lookat constraint pointing at the sun. You then have to restrict the rotation inherited from the dummy to the louvre to the main rotation axis of the louvre only- otherwise it will do all sorts of weird things.
If you’re using an environmental sun (eg in fRender) you would need to have a scripted controller I guess and some trig to do the equivalent of the lookat pulling figures from the render panel (not sure that access to this is working in the current FR build)…
Hope this helps
Alex
Many Thanks for the suggestions, I am actively pursuing them as a solution. Thanks for the tip about the inheritance of rotation, is there any maxscript access to the hierarchy tab in Max? I couldn’t get the macro recorder to record anything I did to pivots and inherits.
Thanks again,
Colin
Hi,
you can try:
sunNormal = $Compass01.pos – $Sun01.transform.row4
It is not the best option but it worked for me
good luck.
G