BY Fabrice :

Hi all,
I get many requests about this and I keep sending code...

So I've added a new class dedicated to this particular functionality.
Drag3D.  in tools.utils package


you can use it to drag an object or just to get the intersection back.

here an example of implementation

               import away3d.tools.utils.Drag3D
               [... usual away code...]
               private var drag3d:Drag3D;

                private function setUp():void
               {
                       //the object you want to drag
                       var _debugPrimitive:Sphere = new Sphere({radius:50,
material:null});
                       this.scene.addChild(_
debugPrimitive);

                       //declare instance
                       drag3d = new Drag3D(this.view);
                       //which plane do you want to drag on
                       // note here that plane != Plane primitive!!
                       drag3d.plane = "xz";
                       // in case you want to check what you are doing
                       //drag3d.debug = true;
                       // to assign an object to be dragged
                       drag3d.object3d = _debugPrimitive;
               }


               private function myEnterFrame(event:Event = null):void
               {
                       //will update the object automatically on mouse moves
                       drag3d.updateDrag();  // its is of course handy to
couple this with mouseEvents, like "if mouseisdown --> drag"

                       // in case you want only the position intersect back
                       var intersect:Number3D = drag3d.getIntersect();

                       this.view.render();
               }

next to 0,0,0 default, there are also options for custom positions of plane,
in case of AABB tests and even support for rotated planes
if you want object aligned calcs...

here a little tech demo
http://www.closier.nl/playground/drag/drag3d.swf

cheers,


Fabrice


On Thu, Aug 26, 2010 at 9:18 AM, Bobby <[email protected]> wrote:

> Sorry , I mean Drag3D . Sorry for the mistake.
>
>


-- 
Michael Ivanov ,Programmer
Neurotech Solutions Ltd.
Flex|Air |3D|Unity|
www.neurotechresearch.com
http://blog.alladvanced.net
http://www.meetup.com/GO3D-Games-Opensource-3D/
Tel:054-4962254
[email protected]
[email protected]

Reply via email to