Away3D rotate scene with mouse - actionscript-3

I have a simple scene using the Away3D library and the scene display a simple shape. I'm now dealing with Mouse Events trying to get the effect of rotating the 3D object based on the main coordinates system, but i do not get how to get the initial values when mouse is pressed and what to assign when mouse is moving.
Anyone can help me?

Look at the Intermediate Globe example in the Away3D repository. There is an HoverController class that should have all the functionality you need to handle mouse inputs and rotate the camera around your 3D shape.

Related

Create Depth Mask of camera scene in Spark AR

I need to generate a Depth Mask image of my 3D environment in Spark AR. I need this so I can use it as a Depth Mask in a Scene Render Pass for a glow effect. Currently, the glow is rendering over the top of other objects in my scene. I can't just render everything else on top because the user can move around and view the scene from any angle.

Dragging an object around (libgdx)

Question: How do you drag an object in a 3d environment with libgdx?
I manage to pick the object by using a Ray projected from the screen point that I touch and checking if intersects the object's bounding box but I don't understand how to actually update its position. What I'm trying to achieve is a movement on the xz plane, so that when I drag my finger towards the upper ( or lower) end of the screen, the objects move in depth on the plane. Anybody can help?

Can objects drawn in canvas response to mouse events?

can I make objects drawn in canvas response to mouse events? for example, to change colors or to display toolips on mouseover? I can adjust some values by using other types of inputs (range, radio...), but cannot make direct mouse manipulation on objects drawn in canvas.
No.
Anything drawn on html canvas becomes unremembered pixels.
What you will need to do is "remember" everything about all the things you've drawn: shape, position, color.
Then you can respond to mouse events and compare the mouse position with the bounding boxes of your remembered drawings.
If you want to change any drawing (recolor, reposition, etc), you must redraw that drawing.
Most often when you redraw any one thing, you will erase the entire canvas and redraw all items that were on the canvas.
You can listen for mouse events on the canvas. The rest is up to you. If you keep a list of objects drawn on the canvas, you can scan through the list looking for one that is under the mouse.

mousedown not working on layer in kineticjs

i have been working with a kineticjs game where i have kept one layer for the background, one for the player's character, and others,all together having the same kinetic stage.
Then I ran into a situation where I needed a shape of one layer where i can add multiple events,but though the mouse event are working on the stage they are not getting called on particular shape.I have tried layer.on('mousedown',function(),false);
its not working
try shape.on('mousedown', function().....); as Ani says

Are there any libraries providing mouse-driven zoom/pan for pure AS3 projects?

Today I wanted to add mouse-driven zoom and pan functionality to a pure AS3 project - something like the Google Maps interface. I was surprised that I couldn't find a good package or library to do this already - I'm using FlashDevelop rather than Flash CS3, so the nice VCam tool available as an FLA is no use.
There's nothing very complicated involved in implementing zoom/pan, although it can be fiddly and time-consuming to get right, but since zooming and panning are pretty common things to want to do I wondered if anyone could suggest a 'correct' way to do this in the Flash world, or a good library available that I haven't been able to find.
I found exactly what I was looking for in the flare library's PanZoomControl:
Interactive control for panning and
zooming a "camera". Any sprite can be
treated as a camera onto its drawing
content and display list children. To pan and zoom
over a collection of objects, simply
add a PanZoomControl for the sprite
holding the collection.
var s:Sprite; // a sprite holding a collection of items
new PanZoomControl().attach(s); // attach pan and zoom controls to the sprite
The mouse controls are also implemented as you'd expect:
Once a PanZoomControl has been
created, panning is performed by
clicking and dragging. Zooming is
performed either by scrolling the
mouse wheel or by clicking and
dragging vertically while the control
key is pressed.
You could use a 3D library such as Papervision3D or FIVe3D. Then just move your camera based on different mouse events/gestures. Or use the built in z-axis in FlashPlayer 10 to get the zoom effect.