How to drag Loader3D

Software: Away3D 4.x

ramose, Newbie
Posted: 06 February 2015 03:53 AM   Total Posts: 5

I’ve imported 3ds object into scene with Loader3d. How to enable to drag it around with Drag3D?

Thanks.

   

Pierce, Jr. Member
Posted: 07 February 2015 03:42 PM   Total Posts: 40   [ # 1 ]

create an instance of Drag3D:
>> var _drag:Drag3D;
>> _drag = new Drag3D( {the View3D your mouse is dragging on} ,
          {the ObjectContainer3D you’re dragging} ,
          {the plane you are dragging on} );

to actually drag the object, in your enterframe or wherever you are updating your view, update the drag:
>> _drag.updateDrag();

Loader3D extends ObjectContainer3D so you should be able to pass it into Drag3D directly, but if not then use the data from Loader3D to create a proper Mesh or something.

   

ramose, Newbie
Posted: 08 February 2015 11:39 PM   Total Posts: 5   [ # 2 ]

Thanks, Pierce. It works smile

However, I have these problems :
1. everytime ‘mouseDown’ everywhere, the object will suddenly move to that mouse position
2. I have two and more objects. How can I change the active object as the ObjectContainer3D. I fail to catch the clicked object inside ‘SpriteVisualElement’

smile

   

ramose, Newbie
Posted: 10 February 2015 02:31 AM   Total Posts: 5   [ # 3 ]

Solve it.

I’m using ‘drag3D.offsetCenter = true;’ and it works. smile

   

Pierce, Jr. Member
Posted: 11 February 2015 08:58 PM   Total Posts: 40   [ # 4 ]

Yep! And as to the 2nd issue, if you didn’t already realize this, in addition to assigning a different object to your drag3D, you can also use multiple drag3Ds simultaneously, as it is an instanced class rather than a singleton.

   

ramose, Newbie
Posted: 11 February 2015 11:18 PM   Total Posts: 5   [ # 5 ]

Got it. Many thanks smile

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X