UPDATE 29/09/09: This technique is possibly no longer valid with the latest version of Papervision3D.
Here is a small example I put together quickly today to demonstrate how to drag in 3D using Papervision and the InteractiveUtils.getMapCoordAtPointDO3D function.
Since my last post on this in December last year, the Papervision getMapCoordAtPointDO3D method returned object’s x and y values seemed to have changed by a factor of 36.
UPDATE 29/09/09: This technique is possibly no longer valid with the latest version of Papervision3D.
private function _updateDrag(e:Event):void
{
// get the update position on the plane
var obj:Object = InteractiveUtils.getMapCoordAtPointDO3D(_selectedPlane,
_selectedPlane.container.mouseX,
_selectedPlane.container.mouseY)
// move the dragged plane to the new postion with the offset
_selectedPlane.x = _selectedPlane.x + obj.x * 36 - _drag_X_offset;
_selectedPlane.y = _selectedPlane.y - obj.y * 36 + _drag_Y_offset;
}
Click here to see it in action.
The source files can be downloaded here.
Thank you very much for this example!!
You’re welcome. Bear in mind the Papervision classes are trunk v1_7 or something and I haven’t checked if it will compile and run with the latest release. Make sure you post a link to your project here once it is complete!
…. It can be a problem , but I will give a check. Actually I managed to write a code that drags the PV3D geometry and adds to it acceleration which depends on the speed of mouse move . But my workaround was to deal with the container of the specific geometry so I get an access to the start/stopDrag functions and from then on it was just some 2D Math . Anyway your approach seems more like 3d oriented that is why I like it .
Have a nice day!
By the Way I am coming to Flash on the Beach too . I will be glad to have a talk with you about tips and tricks in PV3D If you are interested
Thanks again
Hey Dan ! . I would like to inform you that your approach does not work in the current version of PV3D . It behaves very different when you drag objects . Thanks anyway
Thanks Michael, I’ve updated the post. I hope you enjoyed FOTB as much as I did!