<?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>Tapdancing Goats &#187; 3d</title>
	<atom:link href="http://www.tapdancinggoats.com/tag/3d/feed" rel="self" type="application/rss+xml" />
	<link>http://www.tapdancinggoats.com</link>
	<description>A parfait of physics, Linux, LaTeX, and coding tips large and small.</description>
	<lastBuildDate>Wed, 25 Jan 2012 03:14:39 +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>Better billboarding in Papervision3D</title>
		<link>http://www.tapdancinggoats.com/better-billboarding-in-papervision3d.htm</link>
		<comments>http://www.tapdancinggoats.com/better-billboarding-in-papervision3d.htm#comments</comments>
		<pubDate>Thu, 08 Nov 2007 02:42:30 +0000</pubDate>
		<dc:creator>Alex</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[3d]]></category>
		<category><![CDATA[billboard]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[example]]></category>
		<category><![CDATA[fix]]></category>
		<category><![CDATA[graphics]]></category>
		<category><![CDATA[Papervision3D]]></category>

		<guid isPermaLink="false">http://www.tapdancinggoats.com/better-billboarding-in-papervision3d.htm</guid>
		<description><![CDATA[The Papervision3D wiki has an example for making billboarded sprites with just three extra lines of code. Trouble is, it doesn&#8217;t really work. Anyone who&#8217;s tried it may have noticed that when the planes get too close to the camera, or if the camera rotates around it&#8217;s z-axis at all, the planes start rolling instead [...]]]></description>
			<content:encoded><![CDATA[<p>The <a href="http://wiki.papervision3d.org/">Papervision3D wiki</a> has an example for making billboarded sprites with just three extra lines of code. Trouble is, it doesn&#8217;t really work. Anyone who&#8217;s tried it may have noticed that when the planes get too close to the camera, or if the camera rotates around it&#8217;s z-axis at all, the planes start rolling instead of staying vertical.</p>

<p>The problem is that the lookAt method defaults to using the world y-axis as &#8220;up&#8221; for the billboards, which isn&#8217;t usually correct.  Of course we don&#8217;t really care about the world y-axis with billboards.  We just want them to be vertical in the camera.  Here&#8217;s some code that does it.</p>

<div class="dean_ch" style="white-space: wrap;"><span class="co1">// calculate the camera vertical in world coordinates</span><br />
<span class="kw2">var</span> <span class="kw3">up</span> : Number3D = <span class="kw2">new</span> Number3D<span class="br0">&#40;</span><span class="nu0">0</span>, <span class="nu0">1</span>, <span class="nu0">0</span><span class="br0">&#41;</span>;<br />
Matrix3D.<span class="me1">rotateAxis</span><span class="br0">&#40;</span><span class="kw3">camera</span>.<span class="me1">transform</span>, <span class="kw3">up</span><span class="br0">&#41;</span>;<br />
<br />
<span class="co1">// billboard is the plane you want to billboard.</span><br />
billboard.<span class="me1">lookAt</span><span class="br0">&#40;</span>viewpoint, <span class="kw3">up</span><span class="br0">&#41;</span>;<br />
billboard.<span class="me1">roll</span><span class="br0">&#40;</span><span class="nu0">180</span><span class="br0">&#41;</span>;<br />
billboard.<span class="me1">pitch</span><span class="br0">&#40;</span><span class="nu0">180</span><span class="br0">&#41;</span>;</div>
]]></content:encoded>
			<wfw:commentRss>http://www.tapdancinggoats.com/better-billboarding-in-papervision3d.htm/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

