<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>ActionScript Scraps &#187; papervision</title>
	<atom:link href="http://blog.sitedaniel.com/tag/papervision/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.sitedaniel.com</link>
	<description>Flash, Flex and AIR development</description>
	<lastBuildDate>Wed, 28 Jul 2010 11:15:35 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Dragging in Papervision 3D &#8211; example</title>
		<link>http://blog.sitedaniel.com/2009/09/dragging-in-papervision-3d-2/</link>
		<comments>http://blog.sitedaniel.com/2009/09/dragging-in-papervision-3d-2/#comments</comments>
		<pubDate>Fri, 04 Sep 2009 15:51:36 +0000</pubDate>
		<dc:creator>Daniel</dc:creator>
				<category><![CDATA[actionscript]]></category>
		<category><![CDATA[as3]]></category>
		<category><![CDATA[as3.0]]></category>
		<category><![CDATA[dragging]]></category>
		<category><![CDATA[example]]></category>
		<category><![CDATA[paper]]></category>
		<category><![CDATA[papervision]]></category>
		<category><![CDATA[papervision3d]]></category>
		<category><![CDATA[source]]></category>

		<guid isPermaLink="false">http://blog.sitedaniel.com/?p=343</guid>
		<description><![CDATA[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 [...]]]></description>
			<content:encoded><![CDATA[<p><strong>UPDATE 29/09/09: This technique is possibly no longer valid with the latest version of Papervision3D.</strong></p>
<p><a href="http://blog.sitedaniel.com/demo/3D_dragging/main.swf" rel="shadowbox;height=600;width=900"><br />
<img src="http://blog.sitedaniel.com/wp-content/uploads/2009/09/screenshot.png" alt="Dragging in Papervision example" title="screenshot" width="400" height="270" class="size-full wp-image-345" /></a></p>
<p>Here is a small example I put together quickly today to demonstrate how to drag in 3D using Papervision and the InteractiveUtils.getMapCoordAtPointDO3D function.<br />
Since my <a href="http://blog.sitedaniel.com/2008/12/dragging-in-papervision-3d/">last post</a> 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.</p>
<p><strong>UPDATE 29/09/09: This technique is possibly no longer valid with the latest version of Papervision3D.</strong></p>
<pre class="actionscript">&nbsp;
<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> _updateDrag<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">e</span>:Event<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
<span style="color: #66cc66;">&#123;</span>
    <span style="color: #808080; font-style: italic;">// get the update position on the plane</span>
    <span style="color: #000000; font-weight: bold;">var</span> obj:<span style="color: #0066CC;">Object</span> = InteractiveUtils.<span style="color: #006600;">getMapCoordAtPointDO3D</span><span style="color: #66cc66;">&#40;</span>_selectedPlane,
                                        _selectedPlane.<span style="color: #006600;">container</span>.<span style="color: #006600;">mouseX</span>,
                                        _selectedPlane.<span style="color: #006600;">container</span>.<span style="color: #006600;">mouseY</span><span style="color: #66cc66;">&#41;</span>
    <span style="color: #808080; font-style: italic;">// move the dragged plane to the new postion with the offset</span>
    _selectedPlane.<span style="color: #006600;">x</span> = _selectedPlane.<span style="color: #006600;">x</span> + obj.<span style="color: #006600;">x</span> * <span style="color: #cc66cc;">36</span> - _drag_X_offset;
    _selectedPlane.<span style="color: #006600;">y</span> = _selectedPlane.<span style="color: #006600;">y</span> - obj.<span style="color: #006600;">y</span> * <span style="color: #cc66cc;">36</span>  + _drag_Y_offset;
<span style="color: #66cc66;">&#125;</span>
&nbsp;</pre>
<p>Click <a href="http://blog.sitedaniel.com/demo/3D_dragging/main.swf" rel="shadowbox;height=600;width=900">here</a> to see it in action.</p>
<p>The source files can be downloaded <a href="http://blog.sitedaniel.com/downloads/3D_plane_dragging_example.zip">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.sitedaniel.com/2009/09/dragging-in-papervision-3d-2/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Dragging in PaperVision 3D</title>
		<link>http://blog.sitedaniel.com/2008/12/dragging-in-papervision-3d/</link>
		<comments>http://blog.sitedaniel.com/2008/12/dragging-in-papervision-3d/#comments</comments>
		<pubDate>Thu, 04 Dec 2008 16:04:41 +0000</pubDate>
		<dc:creator>Daniel</dc:creator>
				<category><![CDATA[actionscript]]></category>
		<category><![CDATA[as3.0]]></category>
		<category><![CDATA[papervision]]></category>
		<category><![CDATA[papervision3d]]></category>

		<guid isPermaLink="false">http://blog.sitedaniel.com/?p=119</guid>
		<description><![CDATA[There doesn't seem to be much out there explaining how to drag something in 3d space. Recently I've had to create some planes that are draggable along one plane (i.e. the z depth doesn't change but the x and y coordinates will). Doing this involves converting 2D coordinates into 3D coordinates. There is a built [...]]]></description>
			<content:encoded><![CDATA[<p>There doesn't seem to be much out there explaining how to drag something in 3d space. Recently I've had to create some planes that are draggable along one plane (i.e. the z depth doesn't change but the x and y coordinates will). Doing this involves converting 2D coordinates into 3D coordinates. There is a built in function in Papervision that does this:</p>
<p><strong>InteractiveUtils.getMapCoordAtPointDO3D(...)</strong></p>
<p>So by passing the plane in to this, along with the mouseX and mouseY relative to the plane, we can get all the values needed for dragging.</p>
<p>Please note: I'm using pv3d\as3\tags\1_7\src as my base class, so this isn't v2.0.</p>
<pre class="actionscript">&nbsp;
<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> _startDrag<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">e</span>:MouseEvent<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
<span style="color: #66cc66;">&#123;</span>
    <span style="color: #808080; font-style: italic;">// get the plane from my dictionary where all my planes are</span>
    <span style="color: #808080; font-style: italic;">// this is org.papervision3d.objects.Plane;</span>
    _dragPlane = dict<span style="color: #66cc66;">&#91;</span><span style="color: #0066CC;">e</span>.<span style="color: #0066CC;">target</span><span style="color: #66cc66;">&#93;</span>.<span style="color: #006600;">pl</span>;
&nbsp;
    <span style="color: #808080; font-style: italic;">// start the enterframe function</span>
    addEventListener<span style="color: #66cc66;">&#40;</span>Event.<span style="color: #006600;">ENTER_FRAME</span>, _updateDrag<span style="color: #66cc66;">&#41;</span>;
&nbsp;
    <span style="color: #808080; font-style: italic;">// get the intial mouseX and Y offset from</span>
    <span style="color: #808080; font-style: italic;">// where the user has clicked on the plane</span>
    <span style="color: #000000; font-weight: bold;">var</span> obj:<span style="color: #0066CC;">Object</span> =
            InteractiveUtils.<span style="color: #006600;">getMapCoordAtPointDO3D</span><span style="color: #66cc66;">&#40;</span>_thePlane,
            _thePlane.<span style="color: #006600;">container</span>.<span style="color: #006600;">mouseX</span>,
            _thePlane.<span style="color: #006600;">container</span>.<span style="color: #006600;">mouseY</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
        <span style="color: #808080; font-style: italic;">// save these coordinate offset values to use while dragging</span>
        _drag_X_offset = obj.<span style="color: #006600;">x</span>;
        _drag_Y_offset = obj.<span style="color: #006600;">y</span>;
    <span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> _updateDrag<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">e</span>:Event<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
<span style="color: #66cc66;">&#123;</span>
    <span style="color: #808080; font-style: italic;">// get the updated position of the plane</span>
    <span style="color: #000000; font-weight: bold;">var</span> obj:<span style="color: #0066CC;">Object</span> =
                InteractiveUtils.<span style="color: #006600;">getMapCoordAtPointDO3D</span><span style="color: #66cc66;">&#40;</span>_thePlane,
                _thePlane.<span style="color: #006600;">container</span>.<span style="color: #006600;">mouseX</span>,
                _thePlane.<span style="color: #006600;">container</span>.<span style="color: #006600;">mouseY</span><span style="color: #66cc66;">&#41;</span>
&nbsp;
    <span style="color: #808080; font-style: italic;">// move the dragged plane to the new postion with the offset</span>
    _thePlane.<span style="color: #006600;">x</span> = _thePlane.<span style="color: #006600;">x</span> + obj.<span style="color: #006600;">x</span> - _drag_X_offset;
    _thePlane.<span style="color: #006600;">y</span> = _thePlane.<span style="color: #006600;">y</span> - obj.<span style="color: #006600;">y</span> + _drag_Y_offset;
<span style="color: #66cc66;">&#125;</span>
&nbsp;</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.sitedaniel.com/2008/12/dragging-in-papervision-3d/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>New PORTFOLIO site!!!!</title>
		<link>http://blog.sitedaniel.com/2008/07/new-portfolio-site/</link>
		<comments>http://blog.sitedaniel.com/2008/07/new-portfolio-site/#comments</comments>
		<pubDate>Fri, 25 Jul 2008 10:25:23 +0000</pubDate>
		<dc:creator>Daniel</dc:creator>
				<category><![CDATA[actionscript]]></category>
		<category><![CDATA[as3.0]]></category>
		<category><![CDATA[papervision]]></category>
		<category><![CDATA[papervision3d]]></category>
		<category><![CDATA[portfolio]]></category>
		<category><![CDATA[sites]]></category>

		<guid isPermaLink="false">http://blog.sitedaniel.com/?p=52</guid>
		<description><![CDATA[I've just completed rebuilding my portfolio using AS3.0 and some PaperVision3D. Many of the sites I have built or worked on over the last few years are up there so hopefully this will help me drum up some more contract work. http://www.sitedaniel.com]]></description>
			<content:encoded><![CDATA[<p>I've just completed rebuilding my portfolio using AS3.0 and some PaperVision3D. Many of the sites I have built or worked on over the last few years are up there so hopefully this will help me drum up some more contract work.</p>
<p><a href="http://www.sitedaniel.com">http://www.sitedaniel.com</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.sitedaniel.com/2008/07/new-portfolio-site/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
