Page 1 of 1

Spinning an object (restored)

Posted: Wed Jul 03, 2024 1:53 am
by JM_Y
Hi

I saw the Animating rotation thread about an animation example. Correct me if I'm wrong I think I saw in help that one can have series of 'viewpoints' and a time to animate between each point.

However, what we were hoping to do is give the user a couple buttons, rotate left and rotate right. As long as they hold the buttons down the manikin will rotate. Does the animation method have a loop method in it in case the user holds the button down for longer then there are waypoints in the array?

Also does it also have a method that we could cancel the animation in the event the user releases the button. We were hoping for a couple things, 1) both models to rotate precisely at the same time, giving the appearance that they are the same model. 2) Rotating that more closely (smoothly) represents the rotation you get when dragging the model around with the mouse.

Thanks
JM

Re: Spinning an object (restored)

Posted: Wed Jul 03, 2024 1:54 am
by Nick
For spinning the viewpoints array will be probably bit cumbersome. They are designed to avoid sudden jumps in view when switching viewpoints, so they are more suitable for very short non-continuous animations.

The View Point sample Sample Explorer > View > View Point or C:\Projects\KernelCAD_4_3\Samples\NET\C#\ViewPoint project shows how to code spinning of view. It is good to look at first. You would need to add timer for animation.

Animation of spinning view is also implemented in Rotation sample. See it in Sample Explorer > View > Rotation. There is only C++ code unfortunately. You can open it in Visual Studio: C:\Projects\KernelCAD_4_3\Samples\VC\Rotation. It should be pretty clear.

Synchronisation of the views can be done using the Eye frame. In the View Point example it is accessed in OnFormLoad(). The frame is fully controllable in code. You can copy eye frame of one control to another and rotate it around y axis by 180 degrees to have the view from the opposite side.

Re: Spinning an object (restored)

Posted: Wed Jul 03, 2024 1:56 am
by JM_Y
Thank you, Nick

Our observation is that the rotation method via the buttons (demonstrated in the sample project we sent) isn't as smooth as we would like to see it.

When we use the internal KernCad mouse drag, i.e. if you run the sample project -> left click and hold on the object -> drag around so the object is spinning. This is the performance we are looking for, the object smoothly rotates following the mouse cursor but we want to do it with the button GUI.

Is this possible to obtain or improve upon our existing code? If so how does the code in our sample project have to change to attain the performance?

JM

Re: Spinning an object (restored)

Posted: Wed Jul 03, 2024 1:59 am
by Nick
Sorry about the confusion

I have mentioned Rotation only because there is Animate button. C# does not have examples with view animation.

We should also remove reference to the bird's eye example. It got lost on the way few years ago as it was considered non-essential. We need to rewrite it more efficiently. It was a great demo of what I wrote in the paragraph about eye frame.

Here it is: http://www.dynoinsight.com/Prod/KernelC ... 4_3143.exe

I recommend having a look at the sample. Sample Explorer > View > Birds eye. The product is small. It can be installed simultaneously with 4.3. You need only to execute "Update Component Registration" in Start menu to activate one or the other.
Ask any questions

Regards
Nick

Update July 2024

Posted: Wed Jul 03, 2024 2:04 am
by Nick
Sorry, the link does not work anymore. The functionality demoed in the sample is integrated into the component now: Right-click on any DGK window. Go to Advanced > View > Birds Eye (v + b keys shortcut).