<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Maratis forum - 1st Person Camera Made Easier]]></title>
	<link rel="self" href="http://forum.maratis3d.com/extern.php?action=feed&amp;tid=1065&amp;type=atom"/>
	<updated>2014-08-21T19:39:04Z</updated>
	<generator>PunBB</generator>
	<id>http://forum.maratis3d.com/viewtopic.php?id=1065</id>
		<entry>
			<title type="html"><![CDATA[Re: 1st Person Camera Made Easier]]></title>
			<link rel="alternate" href="http://forum.maratis3d.com/viewtopic.php?pid=7220#p7220"/>
			<content type="html"><![CDATA[<p>I put the functions in separate file and linked it using the &quot;dofile()&quot; function</p>]]></content>
			<author>
				<name><![CDATA[Tutorial Doctor]]></name>
				<uri>http://forum.maratis3d.com/profile.php?id=2493</uri>
			</author>
			<updated>2014-08-21T19:39:04Z</updated>
			<id>http://forum.maratis3d.com/viewtopic.php?pid=7220#p7220</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[1st Person Camera Made Easier]]></title>
			<link rel="alternate" href="http://forum.maratis3d.com/viewtopic.php?pid=7217#p7217"/>
			<content type="html"><![CDATA[<p>I wanted to adjust the Sponza 1st person script so that it can be used in other projects easier. Here is the code:</p><div class="codebox"><pre><code>-----------------------------------------------------------------------------------
-- Maratis
-- Jules script test
-----------------------------------------------------------------------------------

Head = getObject(&quot;Head&quot;)

function Initialize()
    dx = 0.0
    dy = 0.0

    centerCursor()
    mx = getAxis(&quot;MOUSE_X&quot;)
    my = getAxis(&quot;MOUSE_Y&quot;)
end

Initialize()

function LookWith(object)

    -- rotate object (X mouse)
    rotate(object, {0, 0, -1}, dx*100)
    
    -- rotate object (Y mouse)
    rotate(object, {-1, 0, 0}, dy*100, &quot;local&quot;)    
    rotation = getRotation(object)
        
    if rotation[1] &gt; 90 then
        rotation[1] = 90
    elseif rotation[1] &lt; -90 then
        rotation[1] = -90
    end

    setRotation(object, rotation)
    
    -- get mouse direction
    dx = getAxis(&quot;MOUSE_X&quot;) - mx
    dy = getAxis(&quot;MOUSE_Y&quot;) - my

    -- center cursor
    centerCursor()
    
    mx = getAxis(&quot;MOUSE_X&quot;)
    my = getAxis(&quot;MOUSE_Y&quot;)
end

-- scene update
function onSceneUpdate()
        LookWith(Head)
end</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Tutorial Doctor]]></name>
				<uri>http://forum.maratis3d.com/profile.php?id=2493</uri>
			</author>
			<updated>2014-08-21T19:05:10Z</updated>
			<id>http://forum.maratis3d.com/viewtopic.php?pid=7217#p7217</id>
		</entry>
</feed>
