Message 1 of 4
Revolute Joint Motion Faster/Smoother via Animate than driven by Script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I've got some Revolute joints. If I use the Animate option on the model the motion of the joint is really nice and smooth and fast...
But if I use a C++ Script to do the animation it's quite jerky and not nearly as fast...
The script that's driving the joint is basically this...
double Pi = 3.1415926535897; double angle360DegreesInPiTerms = 2*Pi; double angle180DegreesInPiTerms = Pi; double angle90DegreesInPiTerms = Pi / 2; double angle45DegreesInPiTerms = Pi / 4; double angle1DegreeInPiTerms = 0.0174533; double angle0DegreeInPiTerms = 0.0; // Move joint UP 90 degrees (from initial 0 degrees) for (double angle = 0.0 ; angle <= angle90DegreesInPiTerms; angle += angle1DegreeInPiTerms * 3) { itsRevoluteJointMotion->rotationValue(angle); adsk::doEvents(); } // Move joint down to -90 degrees for (double angle = angle90DegreesInPiTerms; angle >= -angle90DegreesInPiTerms; angle -= angle1DegreeInPiTerms * 3) { itsRevoluteJointMotion->rotationValue(angle); adsk::doEvents(); } // Move joint back to 0 degrees for (double angle = -angle90DegreesInPiTerms; angle <= 0.0 ; angle += angle1DegreeInPiTerms * 3) { itsRevoluteJointMotion->rotationValue(angle); adsk::doEvents(); }
So why is the model-driven Animate so much faster and smoother than one driven by a C++ script? I tried several different "increments" in the for-loops and nothing makes it any better.