[Closed] Lookat Angle Snap Question
@Shegon. I will hopefully be able to take some time soon to have another look at this and guide you. But at this stage, I can say that my solution above uses a script controller. Expression controllers are harder to read and harder to write so I’ve not had a chance to make an expression version of this as yet. Mainly cause I can’t see an good way to do “as integer” in an expression. I have a way, but it’s not so elegant and haven’t got it fully working as yet. So I’d just stick wit the script controller version for the time being.
If you run the script that I posted above, it will make the scene with all the controllers and objects. And I’ll try to get back to this soon. Sorry, work and life is quite busy at the moment.
Cg.
I pasted the code you wrote into a script as you suggested and it worked beautifully! Thank you so much. This would have taken me exponentially longer without your help.
Just a small bit of extra info. If you want to link the whole thing to something to be able to rotate the whole thing around and instead of having it utilise world Z rotation, and you want local, then change the following line
zRotScript.addtarget "driver" expTrans.worldEulerZ.controller
to
zRotScript.addtarget "driver" expTrans.localEulerZ.controller
All that is changed is that the word “world” is changed to “local”.
You can either change it in the script that creates everything, or if you have a scene setup with these already and need to change them, just update the script controllers to point the “driver” variable to the localEulerZ on the expose transform node. rather than worldEulerZ