how to set "objects" property in aframe raycaster component - aframe

I want to use raycaster component in <a-cursor> entity to intersect some
cubes.
I set the objects property like '#box' (my cube's id), but the cursor still
intersects all element.
I step into the raycaster source code, and the data.objects is '' .
So, I wonder if I set the property in a wrong way?

There was a bug in A-Frame with dependency components. It's been fixed in the Dev Builds: https://github.com/aframevr/aframe/tree/master/dist#dev-builds and will be released with 0.4.0.
A workaround is to put the raycaster component before the cursor:
<a-entity raycaster="..." cursor="..."></a-entity>

Related

How To Programmatically Rotate The Camera In The A-FRAME Scene?

I would like to programmatically rotate the camera in the A-FRAME scene in a similar way that you can click and drag the mouse to rotate the camera around the scene. Is this possible to do?
A more detailed description of the problem will help you get a more precise answer. A-Frame already lets you click and drag the mouse to move the camera via the look-controls component . There's also a component called orbit controls that rotates the camera around a target point. If you want to implement your own, create a and apply a component to the camera that manipulates its rotation on the tick method
tick: function () {
this.el.object3D.rotation.set(...);
}
You apply your component in the HTML as follows:
<a-entity camera your-component></a-entity>
In case when look-controls component is used, it will override the rotation of the camera element, so one has to set internal attributes of the look-controls component.
Overriding mouse control rotation value in that component can be done like this:
aCamEl.components['look-controls'].pitchObject.rotation.set(THREE.Math.degToRad(pitch),0,0);
aCamEl.components['look-controls'].yawObject.rotation.set(0,THREE.Math.degToRad(yaw),0);

Does the a-cursor of a-frame detect invisible entities?

Right now, the cursor does not seem to identify entities which are invisible. However, I can make visible entities become invisible using the animations.
Any way to do the inverse?
Thanks.
Try using making objects invisible using the material opacity rather than the entire object visible.
<a-entity material="opacity: 0"></a-entity>

flex popup that stays inside a container

I retrieved a fine component for drawing in flex. It uses some floating toolpalette like:
toolBox = PopUpManager.createPopUp( this, ToolPalette ) as ToolPalette;
I tried to integrate that component into a new flex MXML component like a tileWindow:
Works fine except that these tools palette are OUTSIDE the component.
Is there a way to constrain the toolBox created with PopupManager to stay within its parent container ?
regards
I used createPopUp when the popup component was "titleWindow". But when I want a Canvas component added in the popup, I created a titleWindow and added the Canvas component as a child to the TitleWindow.
var titleWindow:TitleWindow;
titleWindow=new ResizableTitleWindow();
titleWindow.showCloseButton=true;
//Canvas Component
var toolPalette:ToolPalette=new ToolPalette();
// Add the Canvas component to the Titlewindow
titleWindow.addChild(toolPalette);
PopUpManager.addPopUp(titleWindow, this, true);
Set the modal property when you call the createPopup method to true.
createPopUp(this, toolPalette, true, null)
By deffinition on adobes site no you can not constrain
createPopUp -- Creates a top-level
window and places it above other
windows in the z-order.
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/mx/managers/PopUpManager.html#addPopUp%28%29
Thats' not saying you couldn't try to create a mask of some sort

Flash/Flex Cursors

I work on a Flex app that loads external Flash resources created in CS3. I've just been reading about how I can use the Flex mx.managers.CursorManager class to change the mouse cursor explicitly. But what I'd ideally like to do is to set a mouse cursor property on some elements in the loaded Flash SWF, so as the cursor passes over this element the cursor automatically changes without me having to respond to mouse events.
Is it possible? Does Flash support this in DisplayObject or something?
It seems the Flash SWF is overriding me. Some objects automatically display the hand cursor with mouse-over, and I can't see a way to turn this off on a DisplayObject?
To set the the "Hand" cursor, as soon as the mouse hovers over a element you have to specify these properties:
<mx:VBox
useHandCursor="true"
mouseChildren="false"
buttonMode="true">
However this only works for the Hand cursor. Also take care of the required mouseChildren attribute. You either have to set this to false to achieve the cursor for all contained items or you have to specify the attributes useHandCursor and buttonMode for all elements. However the side effect of settings mouseChildren to false is that all mouse events (mouseOver, mouseOut, click,...) on child elements will no longer work.
In case you want to use a different cursor than the hand cursor I am afraid you have only two possibilities:
Replace the standard hand cursor by your cursor
Use the mouseOver and mouseOut events to set the cursor programmatically.
In any object inheriting from Sprite whose buttonMode and useHandCursor properties are both true, you'll get a hand cursor by default when you roll over it. Some objects do this by default, correct; Button and LinkButton are examples you've probably noticed. Simply setting useHandCursor to false on any of these components will disable the hand cursor easily enough, even when its buttonMode property (which is responsible for dispatching click events) is set to true.
If you want to set your cursor to anything else on mouseOver, though, you'll have to respond to mouse events; there's no way around that. Depending on your design goal, you could break that work out somehow, maybe by inheriting from some other object and then overriding its default behavior, but in some form or other, the runtime needs to know you want those mouse events handled.

Flex: Setting the resgistration point on a display object

What is the best way to change/set a registration point on a Flex 3 display object? I know this isn't really built in to easily change, but does anyone have any suggestions on how I could extend UIComponent to achieve this?
For some reason, the Flash Player API doesn't expose the registration point of DisplayObjects (and the Flash IDE makes them a pain to modify once an object is created). The best solution, as David pointed out, is to add your component as a child of another component (UIComponent would be fine). So, for example, if I had a Button and I wanted its registration point at its center, I'd add it as a child of a UIComponent (not Canvas) and offset the child by setting its position to (-button.width/2, -button.height/2).
Put your DisplayObject inside a sprite and set the DisplayObject's x & y positions to the negitive of your target registration point. Apply all transforms to the Sprite container.
Put it inside a Canvas container, with its clipContent attribute set to false. Within the canvas, you can put your object wherever you like.

Resources