[Interest] [Qt3D] Smooth orbit camera

Sean Harmer sean.harmer at kdab.com
Sat May 6 21:26:05 CEST 2017


Hi,

On 06/05/2017 19:34, Oleg Evseev wrote:
> Hi Andy,
>
> Thanks for tips!
> I thought about standard animation (it's used in planets example by the
> way) but I suppose it's better to use FrameAction:
>
> https://doc.qt.io/qt-5/qt3dlogic-qframeaction.html#details
>
>     The QFrameAction provides a way to perform tasks each frame in a
>     synchronized way with the Qt3D backend. This is useful to implement
>     some aspects of application logic and to prototype functionality
>     that can later be folded into an additional Qt3D aspect.
>
>     For example, the QFrameAction can be used to animate a property in
>     sync with the Qt3D engine where a Qt Quick animation element is not
>     perfectly synchronized and may lead to stutters in some cases.
>
>
> Maybe this with camera movement is not the "some case".
>
>> I haven't looked at the new Qt3D animation stuff, but I think its more
> geared towards animated models, not moving the camera?
>
> I suppose it's for everything related to animation in 3d :)

Yes, you can use it to animate any property. If animating a property of 
a QNode that is known by the aspect backends then it even avoids the 
backend->frontend->backend round trip. For regular QObjects the 
animation is stepped on the backend and property updates sent to the 
frontend.

Any of the approaches you mention should work fine.

Cheers,

Sean

>
> 2017-05-06 21:22 GMT+03:00 Andy <asmaloney at gmail.com
> <mailto:asmaloney at gmail.com>>:
>
>     Oleg:
>
>     The way I did it was to implement a QVariantAnimation-derived class
>     that stores the QCamera's start &end positions, view centres, and up
>     vectors. Then I just set the easing curve & the duration I want and
>     call start(). Works great for my use case.
>
>     I haven't looked at the new Qt3D animation stuff, but I think its
>     more geared towards animated models, not moving the camera?
>
>     (In another case I use QPropertyAnimation directly to animate some
>     arrow drawing in my scene which also works great and is easy to set up.)
>
>     ---
>     Andy Maloney  //  https://asmaloney.com
>     twitter ~ @asmaloney <https://twitter.com/asmaloney>
>
>
>     On Sat, May 6, 2017 at 1:46 PM, Oleg Evseev <ev.mipt at gmail.com
>     <mailto:ev.mipt at gmail.com>> wrote:
>
>         Hi,
>
>         I'm looking for solution to get smooth orbit camera in qt3d.
>         That is for example when I need to change angle of observe it
>         doesn't translate camera immediately, but with some delay, just
>         like in games: when vehicle turn camera follow it with delay.
>
>         Does it make sense to use newest Qt3D animation framework (not
>         yet immersed in the study how to use it), or it would be
>         overkill for that task and it would be better to write special
>         camera controller based on QOrbitCameraController with custom
>         logic for frameAction onTriggered handling?
>
>         Maybe there are some relative examples with ready-to-use math?
>         Will be much appreciate for links.
>
>         Thanks for advices!
>
>         --
>         With best regards, Oleg.
>
>         _______________________________________________
>         Interest mailing list
>         Interest at qt-project.org <mailto:Interest at qt-project.org>
>         http://lists.qt-project.org/mailman/listinfo/interest
>         <http://lists.qt-project.org/mailman/listinfo/interest>
>
>
>
>
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
>

-- 
Dr Sean Harmer | sean.harmer at kdab.com | Managing Director UK
KDAB (UK) Ltd, a KDAB Group company
Tel. +44 (0)1625 809908; Sweden (HQ) +46-563-540090
Mobile: +44 (0)7545 140604
KDAB - Qt Experts



More information about the Interest mailing list