4.1 Mouse location

Software: Away3D 4.x

Tempy111, Sr. Member
Posted: 22 November 2016 01:08 PM   Total Posts: 133

I’m gonna feel like a complete idiot..
I’m using a drag-drop method for moving item onto a 3D stage but while I have the Mouse X and Y I don’t know how to convert that (or get) the positon that is on the Scene3D.

I think it’s something to do with the MouseEvent3D function but.. i’m not sure

   

Hector, Sr. Member
Posted: 22 November 2016 03:41 PM   Total Posts: 137   [ # 1 ]

In Camera3D.as, you have project, unproject, etc. Is that what you mean?

   

Tempy111, Sr. Member
Posted: 22 November 2016 03:47 PM   Total Posts: 133   [ # 2 ]

possibly. I’m not sure I would call the Mouse position on screen normalized coordinates, but that is probably where I’m wrong..

   

Avatar
Fabrice Closier, Administrator
Posted: 22 November 2016 05:33 PM   Total Posts: 1265   [ # 3 ]

Look at Drag3D class…

   

Tempy111, Sr. Member
Posted: 22 November 2016 06:06 PM   Total Posts: 133   [ # 4 ]

I did but I dismissed it as being only for dragging 3D objects around 3D space more then onto but.. looking at it, possible..

   

Tempy111, Sr. Member
Posted: 22 November 2016 10:06 PM   Total Posts: 133   [ # 5 ]

doing some changes to use Drag3d seams a good way of doing it ^_^ problem is… offset..

when at position 0,0 on the screen, the dragable object (a sprite3D in this case) the sprite is centred on the mouse pointer. the further away from this point, the Sprite does seam to keep alignment with the plane (XZ by the way) but it moves ahead of the mouse.. I was wondering about the reason… Hovercam at a 45 degree angle at that point..

I wondered about the OffsetCenter Boolean but turning it to true just .. well.. I don’t know where the sprite is anymore cause I can’t see it. which seams to mean its nog getting the values right.. or something.. I’ll hav eto look into the offsetCenter function a bit more to see why the offset values aren’t coming out right ^_^

======
EDIT: Interesting.. when i’m testing it via FlashDevelop’s device option (so android), it’s offsetting.. when running as a normal Swf, it’s fine.. So I think i’ll need to test it on a real device at some point to see if it’s a android scaling issue or just a emulation (kinda) issue.

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X