Last active
August 7, 2023 02:17
-
-
Save MikeUdin/59a83c9f1de28ebfcf0d250790f53016 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import c4d | |
def main(): | |
ps = op.GetAllPoints() #Points in Local coordinates List | |
m = op.GetMg() #Object Global Matrix | |
center = op.GetMp() #Local coordinates center: https://tinyurl.com/wed88cn | |
rad = op.GetRad() # Geometry radius: https://tinyurl.com/tb6vn64 | |
center -= c4d.Vector(0,rad.y,0) #Move down axis to lowest point. Comment this line to keep axis in a center | |
center *= m #Convert to Global coordinates center | |
new_m = c4d.Matrix(m) #Copy matrix | |
new_m.off = center #Change its center | |
loc_m = ~new_m * m #Get local matrix | |
op.SetAllPoints([loc_m.Mul(p) for p in ps]) | |
op.SetMg(new_m) | |
op.Message(c4d.MSG_UPDATE) | |
c4d.EventAdd() | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment