replace WASD keys navigation with VR tracked controllers a-frame - aframe

I've developed an a-frame scene in a different location to where I will be able to use a headset (either oculus or HTC).
Is the tracked controller functionality built into aframe 0.7.0?
Is there code I need to add to detect these controllers and replace the desktop WASD navigation with the tracked controllers? I don't need any hands to be visible I just need to achieve the up/down/left/right movement in space.
Thanks

Don McCurdy's aframe-extras includes a component called universal-controls that I highly recommend. Specifically there is a gamepad-controls component that may do exactly what you're looking for right out of the box.
If not, universal-controls supports extending the main component with "custom" controllers. The ability to do so is lightly documented on the repository page, but it's pretty straightforward. I'm working on one for the GearVR controller that responds to pressing the GearVR trackpad to achieve movement. I still need to work on getting backward movement, but you can find my work so far at Github.
Once you've developed your own custom controller, (or decided to use mine, or whatever), you attach it to your scene's camera, like this:
<a-entity
id='scene-camera'
camera="userHeight: 1.6"
position='24 1.6 14'
universal-controls='movementControls: universal-gear-vr, keyboard;'
universal-gearvr-controls>
Things to note from above: Rather than the default setting, (which will attempt to load all movement controls schemes that are available), I'm telling the universal-controls component to use my custom component, by giving it's name in the movementControls parameter. Notice that I leave off 'controls' from the name though. That's because universal-controls adds that back later. With that said, I also attach my custom component to the camera, which must be done so that universal-controls can find and use it.
A quick note though, on enabling backward movement, if that's something you're interested in. I've already done it by hacking around with the original WASD movement script. You can take a look at what I did if you'd like to see that.

Related

Extend a class to have my custom class rendered as part of the Node graph?

In JavaFX, once I have a Scene, Pane, and/or Canvas setup and have my Node graph setup, how do I add my own custom components? I've already added them to the Node graph, but they're not being rendered, because they neither inherit from a particular node nor implement the particular method necessary to have their rendering method called. There isn't much complexity involved in drawing these components -- it's about twenty calls of drawRectangle etc..
If I recall correctly, in Swing, I had each component implement a version of draw, and draw was called automatically as part of the framework. But I haven't found the equivalent mechanism in JavaFX yet.
JavaFX doesn't have "ondraw" in the usual sense, because components are usually composed and rendered on GPU.
There are multiple ways to create custom drawing, depending on your needs and requirements.
You can merely use Canvas for simple drawing, pretty clear described in official tutorial . This is the simplest way for complex drawings and probably it is what you are looking for. Add canvas node to the scene and draw on it. You can encapsulate the logic by extending Canvas or a container component that will contain Canvas (or by presenter etc. if you employ some kind of MVP/MVC).
Another way is just to compose from existing visual components e.g. shapes and images, for example by extending or preparing a Pane or other container and adding children components.
Yet another is to prepare a bitmap with custom drawing and use Image component, you can use Swing or other APIs to draw a bitmap in advance and use it for rendering. In general this is similar to using canvas but more complex, unless you see clear benefits or have particular reasons, canvas is preferred.
Last way is to implement custom scene Node with complete rendering, I would not go into detail and advice against it; it is relatively complex, will use non-public APIs, probably would not be compatible between JDK releases and is useful only for very special needs.
Note, if you are creating a custom reusable library component, you probably will need to dive into the topic of skinning and component lifecycle.
I needed to pass in the Pane that I'm using for drawing into the constructor of my "custom class." The custom class then adds the necessary shapes to the provided pane. I assume I'll also need to keep track of those shapes as a data member of the custom class and remove/replace them when the custom class needs a new visual representation.
See Fedor Losev's answer below for a more complete list of options. E.g., I could have used a Canvas instead of a Pane.

should I move from caliburn to caliburn.micro

I'm developing an infrastructure for a major project currently based on caliburn 1.
It works fine but it seems like the future is in caliburn micro, am I right?
If I do, how do I implement filters? How do I specify view to a view viewnodel (non conventional)?
And whats the best place to put my splash logic (not root model)
I recommend moving to Caliburn.Micro as it's simpler and easier to extend. It is where any future innovations will be made and it has a larger more active community. As far as filters go, you can actually build them and plug them in. See here Marco's post You can add non-conventional view specification as well. You just plug into the view locator and teach it how to find views. For example, if you want to use an attribute, you can just have the locator look for that attribute first, use it if found, otherwise fall back to the default behavior. Regarding splash logic, you can do that by customizing the Bootstrapper.

Qt and UI Skinning

I wanted to consult with the sages here regarding Qt and skinning, get your opinion and chart a path for my development. My requirements are as follows:
My Qt/C++ application (cross platform with Mac, Windows and Linux versions) needs to have modular skins.
A skin is defined as a set of one or more elements: - Window background texture - Look/feel of UI controls such as edit boxes, drop down, radio buttons, buttons etc. - Look/feel of window "caption", resize grips etc.
Skins will be installed with the application installer, allowing the user to choose which one he/she wants to use. Users should be able to change skins on the fly.
Can I go the QML route? should this be custom and based on simple resources which are built into the application? Any design advice will be appreciated.
Thanks.
If I understood you correctly then stylesheet is the best way forward. You can create stylesheets similar to CSS and then pass them as command line option to your application or load on invocation to style your application at runtime. That way you can create multiple stylesheets each having a different look and feel and allow user to load them at will. Since its CSS it doesn't need any new learning and you can keep all your styling outside your source code.
Here are a list of resources that can get you up and running quickly:
http://blog.qt.io/blog/2007/11/27/theming-qt-for-fun-and-profit/
http://doc.qt.io/qt-5/stylesheet.html
I haven't played with QML yet, but you could also create a custom QStyle implementation that supports your resource format. Note that you'd lose style sheet support if you went this route.
Changing window captions is a little trickier if you want portability.
QML, if I understand correctly, doesn't really skin the widgets, it mainly deals with GUI layout etc etc.
QStyle is used to change the looks. It is a bit low-level though, and requires programming, so if you want to load different user-created skins (from an XML or so) it might be tricky to support extensive skinning. Chaining colors and a few items are easy enough though. (There might be someone else who've done something you could re-use.. not sure.)
For modifying widgets, use QStyle::polish(). You could use that to change the background picture (if it's a top-level window, or of a certain class). There are numerous repaint method to change almost every part of every widget.
Store/load the style using QSettings, by reading and setting the desired Style just after QApplication but before your main window is constructed.

Video or VideoDisplay in Flex: when does it make sense to use one or the other

Flex appears to have 2 video classes: Video and VideoDisplay. My question is when does it make sense to use one or the other?
What I can tell from initial glancing is that VideoDisplay responds to mouse events because it inherits from IntaractiveObject, but I'm not sure if it's a real difference, because Video seems to have a workaround for this in that you can add your own event listeners.
There's probably more to it, but this is the only difference I can see now. So my question for those who used these objects extensively, can you share your experience when you use one over the other.
You'll nearly always want to use VideoDisplay. Video isn't a UIComponent, it can't handle its own loading from URL, won't dispatch any Flex events, and you can't bind to any of the properties such as playHeadTime. Video is a very basic DisplayObject that's capable of displaying video data, and doesn't do much else. It's more of a building-block, that you'd only use if you wanted to do something funky, or are building a Flash (non-flex) app.

How to use "native" custom mouse cursors from within Flash apps?

The most common way of changing a cursor in Flash apps seems to be based on simply hiding the native OS cursor and displaying a graphic (drawn by the Flash Player) inside the Flash rectangle where the (hidden) cursor would be. This is what mx.managers.CursorManager does, for example. The reason why I find this approach unacceptable is that Flash Player isn't nearly fast enough at updating the cursor graphic, leading to some very visible lag in the cursor movement, which I find to be a pretty fundamental usability problem and annoyance, making the whole app seem slower than it really is.
On the other hand, I've noticed that the CSS cursor property implementation in browsers works like it should -- i.e. there's no visible lag in the cursor movement when using it to implement a custom mouse cursor.
So my question is: is there any way to use the CSS cursor property (or any other method that doesn't involve lagging, slow cursor movement) to change the cursor on top of a Flash rectangle?
I've already tried to change the cursor style property for a Flash element (or a Div wrapper around the Flash element) via JavaScript, but didn't seem to get it to work. Has anyone successfully done something like this?
Native cursors are available in Flash Player 10.2 beta. So you should give it a try! See: http://www.bytearray.org/?p=2373
I don't believe there is any way for Flash to use custom system cursors. In my 6 years of being a Flash Developer I've never heard of such functionality or a hack.
I understand your complaints, I too have been frustrated with how laggy the display-update can be. Thinking about the solution to use CSS to set a cursor-style in the browser though is an interesting approach... It smells, but off the top you may be able to implement control over the CSS cursor attribute from Actionscript using ExternalInterface. That way you could presumably communicate back to the HTML container calling some Javascript to modify the HTML page CSS at runtime. Not 100% sure that will work, but it may be worth a try if you are desperate. Otherwise it's probably advisable to stick with CursorManager.
The CursorManager is it, but I haven't had any problems with being laggy.
If you haven't already seen it, check out Colin Moock's CustomMousePointer classes. He has a bunch of AS3 examples and sample code from his Essential AS3 book posted at http://www.moock.org/eas3/examples/. Scroll down to, or search for, the Custom Mouse Pointer link. It's under the Chapter 22 heading.
The code in these examples, incidentally, was originally intended for use by Flash developers, so you may be able to optimize some of them for Flex by using objects that aren't available in Flash's implementation of AS3.
I believe Flash Player 10 will natively let you select the ibar, drag hand, finger or normal cursors, but if you're in Flash 9 this isn't possible and I don't believe a CSS hack will work either.
My advice is - use the MOUSE_MOVE event to position a graphic and set the frame rate as high as possible (e.g. 50 frames per second).
You could in fact accomplish this by writing an ExternalInterface that calls javascript to update the Mousecursor. jQuery functionality would work well here and it is something im doing in my new portfolio site for buttons and various areas of the flash app.
The new portfolio is not up yet, but should be within the next week or two for those are curious it will be at http://chrismcintoshdesigns.com

Resources