Animating rotation

Everything DG Kernel: Technical discussions and issues
Post Reply
Giang_G_Chui
Posts: 1
Joined: Sun Jun 30, 2024 3:32 am

Animating rotation

Post by Giang_G_Chui »

Hello

I need to automate rotation of an object on the screen. What is the right way to do this?

Thank you
Prashant Kande
Posts: 65
Joined: Tue Jun 18, 2024 6:12 am

Re: Animating rotation

Post by Prashant Kande »

Hi

It is important to clarify whether you really need to move objects around in 3D, one relative to another (=object relative to the global frame) or you just need to look at the model from different (moving) point of view. The latter is animation of view. It is faster. This is what happens when you do the normal view manipulation with the mouse.

In sample explorer View > Rotation sample has Animate button, which animates viewing rotation. It uses IFrame_DG.Rotate() to rotate scene on timer event. IFrame here is the eye frame.

Animating the actual movement of object is done nearly same way but the IFrame_DG is the local frame of the object. It is slower, but not much. It can be slow if the object has lots if children objects attached.

The simplest sample for this is: Collision. The animation happens on Move button.

Make sure that your timer period for animation is not too short. Generally, animation needs a bit of tuning in to get it working right. Try starting with very long period like 100. It will be jerky. Reduce it with watching how the behavior changing until you get it smooth.

Regards
Post Reply