<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[GMan's Mods & Stuff — Movement into cameradirection]]></title>
	<link rel="self" href="https://gprogs.com/extern.php?action=feed&amp;tid=448&amp;type=atom" />
	<updated>2011-12-08T10:18:58Z</updated>
	<generator>PunBB</generator>
	<id>https://gprogs.com/viewtopic.php?id=448</id>
		<entry>
			<title type="html"><![CDATA[Re: Movement into cameradirection]]></title>
			<link rel="alternate" href="https://gprogs.com/viewtopic.php?pid=1693#p1693" />
			<content type="html"><![CDATA[<div class="codebox"><pre><code>Function movement()
Local vel:vector3df = vector3df.create()
Local inertia:vector3df = vector3df.create()
Local m:matrix4 = New matrix4
vel = _vector3df(0,0,0)
inertia = _vector3df(0,0,0)
 
 
        If receiver.IsKeyDown(EKEY_KEY_W)
        vel = _vector3df(0,0,MOVEMENT_SPEED * frameDeltaTime))
        ElseIf receiver.IsKeyDown(EKEY_KEY_S)
        vel = _vector3df(0,0,-MOVEMENT_SPEED * frameDeltaTime)
        EndIf
 
        If receiver.IsKeyDown(EKEY_KEY_A)
        vel = _vector3df(-(MOVEMENT_SPEED * frameDeltaTime),0,0))
        ElseIf receiver.IsKeyDown(EKEY_KEY_D)
        vel = _vector3df((MOVEMENT_SPEED * frameDeltaTime),0,0))
        EndIf
        m= camera.getabsolutetransformation()   
        m.rotatevect(vel) 
        inertia.PlusEq(vel:vector3df)
        camera.setposition(camera.getposition().plus(inertia))
        camera.UpdateAbsolutePosition())
 
 
        
End Function</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Infected]]></name>
				<uri>https://gprogs.com/profile.php?id=328</uri>
			</author>
			<updated>2011-12-08T10:18:58Z</updated>
			<id>https://gprogs.com/viewtopic.php?pid=1693#p1693</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Movement into cameradirection]]></title>
			<link rel="alternate" href="https://gprogs.com/viewtopic.php?pid=1691#p1691" />
			<content type="html"><![CDATA[<p>greetings <img src="https://gprogs.com/img/smilies/smile.png" width="15" height="15" alt="smile" />&nbsp; at the top, try updating the code to:<br /></p><div class="codebox"><pre><code>Local velo:vector3df = Vector3df.Create()</code></pre></div>]]></content>
			<author>
				<name><![CDATA[gman]]></name>
				<uri>https://gprogs.com/profile.php?id=2</uri>
			</author>
			<updated>2011-12-07T23:48:51Z</updated>
			<id>https://gprogs.com/viewtopic.php?pid=1691#p1691</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Movement into cameradirection]]></title>
			<link rel="alternate" href="https://gprogs.com/viewtopic.php?pid=1690#p1690" />
			<content type="html"><![CDATA[<p>Hi!<br />Got a problem: i cant move into the direction of the camera.<br />ive searched irrlicht forums, but in this bmaxversion theys solutions wont work at all <img src="https://gprogs.com/img/smilies/hmm.png" width="15" height="15" alt="hmm" /><br />what am i doing wrong?</p><p>Function movement()<br />Local nodePosition:Vector3df = camera.getPosition()<br />Local velo:vector3df</p><br /><p>&nbsp; &nbsp; If receiver.IsKeyDown(EKEY_KEY_W)<br />&nbsp; &nbsp; <br />&nbsp; &nbsp; velo.setZ(nodePosition.getZ() + (MOVEMENT_SPEED * frameDeltaTime))<br />&nbsp; &nbsp; ElseIf receiver.IsKeyDown(EKEY_KEY_S)<br />&nbsp; &nbsp; &nbsp; &nbsp; velo.setZ(nodePosition.getZ() - (MOVEMENT_SPEED * frameDeltaTime))<br />&nbsp; &nbsp; EndIf</p><p>&nbsp; &nbsp; If receiver.IsKeyDown(EKEY_KEY_A)<br />&nbsp; &nbsp; &nbsp; &nbsp; velo.setX(nodePosition.getX() - (MOVEMENT_SPEED * frameDeltaTime))<br />&nbsp; &nbsp; ElseIf receiver.IsKeyDown(EKEY_KEY_D)<br />&nbsp; &nbsp; &nbsp; &nbsp; velo.setX(nodePosition.getX() + (MOVEMENT_SPEED * frameDeltaTime))<br />&nbsp; &nbsp; EndIf<br />&nbsp; &nbsp; <br />&nbsp; &nbsp; Local x:Float,y:Float,z:Float</p><p>&nbsp; &nbsp; Local m:matrix4 = New matrix4<br />&nbsp; &nbsp; m= camera.getabsolutetransformation()<br />&nbsp; &nbsp; m.rotatevect(velo)<br />&nbsp; &nbsp; X=camera.getposition().getX()+velo.getx()<br />&nbsp; &nbsp; Y=camera.getposition().getY()+velo.getY()<br />&nbsp; &nbsp; Z=camera.getposition().getZ()+velo.getZ()<br />&nbsp; &nbsp; camera.setposition(_VECTOR3dF(x,y,z))<br />&nbsp; &nbsp; <br />End Function</p><br /><p>get the error: unhandlet exception: attempt to access field or method of null object at &quot;m.rotatevect(velo)&quot;</p><p>hope anyone can help =/</p>]]></content>
			<author>
				<name><![CDATA[Infected]]></name>
				<uri>https://gprogs.com/profile.php?id=328</uri>
			</author>
			<updated>2011-12-07T18:57:39Z</updated>
			<id>https://gprogs.com/viewtopic.php?pid=1690#p1690</id>
		</entry>
</feed>
