Anyone run into and figured out a method for detecting the scene coordinates (xyz) of a mouse click on an object? Very simply I have a two-dimentional plane (ground) and a box (character) that begins at x0,z0 (directly "on" the plane). I'd like to mouse-click on the plane and move the box to that spot based on the scene x,z. After a few days of trying I'm no closer to solving this seemingly straightforward issue. Anyone wanting to do "click to move" for 3D assets rather than keyboard or mouse drag will need this. Having no real documentation or code-view into the API isn't helping. Am I missing something that should be obvious?
I have to say that I'm a little surprised that there hasn't been any "official' responses to any of our questions. I think the Proscenium team has done a fantastic job so far with this framework. It's simple to setup and get going yet powerful by giving you great depth into the heart of Stage3D without stepping on the framework itself. But, it's not that hard to imagine that there are a lot of us wanting to move into this "new" medium but feel teased by what we've been shown ('code'us-interruptus?). At the moment you either have to know/learn what you need to create your own framework (a big task if you'v enever done it) or use someone elses. In my opinion the existing third-party options are bloated and unwieldy for my purposes. At a time where "everyone" is trying to quickly get their ideas to market with this new tech it's unfortunate we can't get a few simple questions answered. Seriously, if you have a "discussion" and see that any given post has 100 or more views but zero replys, that's not a discussion. You're just talking to yourself.
My appoligies for turning this into a rant.
I think there is ansfer for your question in example file "TestPicking.as".
var node:SceneNode = scene.pick( x, y );
where x and y are 2D screen coordinates
and you get scene object with "position" vector3D - thats all you need to complete your task.
Thanks for the reply pio.
I tried that angle (pun only slightly intended) and was successful in identifying the object directly “behind” the cursor using scene.pick, even getting that object’s world position. But, if my ground plane is positioned at 0,0,0 I can only get that position directly from the object, which doesn’t do me any good. What I need to know are the coordinates of the point where the cursor bisected the object, relative to its center, from the origin of the camera view. That would tell me the direction and distance I would need to move another object within world space.
I thought I had come up with a solution but the immediate problem I ran into was the closed nature of the framework. So, after a few days of unproductive grumbling I decided that the only way I was truly going to accomplish what I wanted was to build everything from the ground-up. I still think Proscenium has great potential but I’m done waiting for a RC. For anyone who’s thought about digging into heart of stage3D and building their own framework, but thought it would be incredibly difficult, well, it is. At least it as for me but anyone who would find it easy probably isn’t in this forum. After climbing a steep learning curve (AGAL and I are back on speaking terms) I finally got going and am extremely pleased with what I’ve accomplished. Granted, I did spend a lot of time initially banging my forehead on my desk but I finally “got it”, and with only a slight concussion.
The resources are out there.
Yes, you are right. Only tesselation of ground object into small pieces could help a bit with this workaround method but you still cant get exact position of click in 3d.
Good luck with your framework and AGAL discoveries.