lou_untitled Posted February 10, 2021 Share Posted February 10, 2021 Hello, I'm trying to automate cogs rotation using vex and a formula I've found online. The basic scenario is the following : one cog 'parent' and one cog 'child'. The cog 'parent' is animated (simple animation on Y axis) and will drive the cog 'child' by the following formula : (cog 'parent') * (-cog 'parent' teeth / cog 'child' teeth) this is quite easy. In the example I provided I 'hardcoded' the teeth count but it is calculated procedurally in a larger setup. All my cogs are packed primitive so I used matrices to modify their rotation. The main problem is when I extract the rotation of the cog 'parent' to modify it, converting the matrix4 into a matrix3 then into a quaternion then into Euler then into degree, it looks like the angle in degree can't go beyond 360°. The rotation in degrees takes weird values. At the frame 87 the extracted rotation Y of the cog 'parent' is 89.5836 degrees but at the frame 88 it's -269.375 which is the same value of angle (90° = 270°) but since the cog 'child' is not symmetrical I can see 'jumping' and If I calculate velocity on top of that the vector between these two frames will be wrong. The value at the frame 88 should be 90.625 not -269.375. I feel like the conversion doesn't allow for value bigger than 360°. I feel like I'm missing on a small thing that can be easily fixed. Is there a solution ? I've tried putting a modulo 360 somewhere but that didn't change anything I've tried dealing only with matrices without converting them but that's out of my knowledge (multiplying the rotation matrices by the ratio driven/driving so (cog 'child' teeth / cog 'parent' teeth) . Thank you for your time, Stay safe. cogs_automation_problem.hiplc Quote Link to comment Share on other sites More sharing options...
tamagochy Posted February 10, 2021 Share Posted February 10, 2021 In your case you can make all much simply cogs_automation_problem_fix.hipnc 2 Quote Link to comment Share on other sites More sharing options...
lou_untitled Posted February 10, 2021 Author Share Posted February 10, 2021 2 hours ago, tamagochy said: In your case you can make all much simply cogs_automation_problem_fix.hipnc This is indeed much simpler and effective, thank you so much ! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.