Aha, a timely guinea pig :)
We've just merged in a bunch of changes to extend the Qt3DInput library.
Please take a look at:
http://code.qt.io/cgit/qt/qt3d.git/tree/examples/qt3d/simple-qml/CameraController.qml
for an example where we exercise the new API a little. We are in the
process of folding something back into Qt3D proper to act as a camera
(or anything else with a transform component) controller, but you can
easily roll your own custom one with what is there now.
The basic concepts are:
1) Instantiate 1 or more QAbstractPhysicalDevice's - MouseController,
KeyboardController so far. These will be renamed to something without
Controller appended shortly. These house a set of "axes" and "buttons".
The axes can be processed in some simple ways as specified by an
AxisSettings object. E.g. for a gamepad controller or other analogue
devices we can support deadzones
(https://codereview.qt-project.org/#/c/143265/) and hopefully tomorrow,
low pass filtering. We also have the ability to add more devices by way
of plugins. We have a WIP plugin for the PS3 SixAxis controller for e.g.
2) The physical devices can be mapped onto LogicalDevices as shown in
the simple-qml example above. This mapping takes the form of specifying
axes and actions on the logical device and declaring which physical
device axis/buttons they originate from. Support for chords and
sequences will land shortly. The logical device allows you to customise
the input within your application to map through to some named axes and
actions in your application and allows support for multiple input
devices and dynamically reconfiguring them.
3) Instantiate a AxisActionHandler component and associate a logical
device with it. The handler's actionStarted(), actionFinished() and
axisValueChanged() signals will be fired as appropriate for you to react
to in a signal handler.
4) If you need to perform smooth animations per frame as a result of
input, also instantiate a LogicComponent and implement it's signal
handler which gets the frame delta-time passed in as an argument. Use
this to multiply your calculated velocity (or whatever) by.
Hope this helps. If you have ideas for how to improve this then please
let us know.
Cheers,
Sean
On 08/12/2015 14:51, Nye wrote:
Hello,
I wish to have the camera movement bound to a certain "slice" of the
world space. I didn't see that to be available through the default
implementation, so I assume I'd have to write my own component that
implements the input aspect and attach it to my camera. I've gone
through the sources, because at this point the documentation is pretty
thin. Unfortunately, I don't seem able to grasp at this point how the
aspect will notify my component of the input events. I have 2 questions:
1. For my case, am I assuming correctly that I'd need my own component
to realize that functionality?
2. If I do need a separate component, how can I make it? I understand
that I have to subclass from QComponent, but how would I be notified
for the input events occurring? Do I need to implement some other
classes to make it work (I saw a number of "functors" created in
Qt3D's source)?
Any help is greatly appreciated.
Kind regards,
Konstantin.
_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest
_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest