<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[GMan's Mods & Stuff — how to rotate camera]]></title>
	<link rel="self" href="https://gprogs.com/extern.php?action=feed&amp;tid=365&amp;type=atom" />
	<updated>2009-03-12T14:32:26Z</updated>
	<generator>PunBB</generator>
	<id>https://gprogs.com/viewtopic.php?id=365</id>
		<entry>
			<title type="html"><![CDATA[Re: how to rotate camera]]></title>
			<link rel="alternate" href="https://gprogs.com/viewtopic.php?pid=1405#p1405" />
			<content type="html"><![CDATA[<p>got it thanks</p>]]></content>
			<author>
				<name><![CDATA[Slenkar]]></name>
				<uri>https://gprogs.com/profile.php?id=40</uri>
			</author>
			<updated>2009-03-12T14:32:26Z</updated>
			<id>https://gprogs.com/viewtopic.php?pid=1405#p1405</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: how to rotate camera]]></title>
			<link rel="alternate" href="https://gprogs.com/viewtopic.php?pid=1403#p1403" />
			<content type="html"><![CDATA[<p>greetings <img src="https://gprogs.com/img/smilies/smile.png" width="15" height="15" alt="smile" />&nbsp; there is a new method in v1.5 on ICameraSceneNode that makes the camera look in the same direction as rotations.&nbsp; look up the method:</p><p>ICameraSceneNode.bindTargetAndRotation()</p>]]></content>
			<author>
				<name><![CDATA[gman]]></name>
				<uri>https://gprogs.com/profile.php?id=2</uri>
			</author>
			<updated>2009-03-11T01:10:40Z</updated>
			<id>https://gprogs.com/viewtopic.php?pid=1403#p1403</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: how to rotate camera]]></title>
			<link rel="alternate" href="https://gprogs.com/viewtopic.php?pid=1397#p1397" />
			<content type="html"><![CDATA[<p>got it, thanks</p><p>It was pointing at 0.0.0 <img src="https://gprogs.com/img/smilies/smile.png" width="15" height="15" alt="smile" /></p>]]></content>
			<author>
				<name><![CDATA[Slenkar]]></name>
				<uri>https://gprogs.com/profile.php?id=40</uri>
			</author>
			<updated>2009-03-10T12:46:27Z</updated>
			<id>https://gprogs.com/viewtopic.php?pid=1397#p1397</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: how to rotate camera]]></title>
			<link rel="alternate" href="https://gprogs.com/viewtopic.php?pid=1396#p1396" />
			<content type="html"><![CDATA[<p>That&#039;s because cameras are always pointing at a target. You would have to change to camera target too.<br />Check out irrb3d for this there should be the solution somewhere.</p>]]></content>
			<author>
				<name><![CDATA[porcus]]></name>
				<uri>https://gprogs.com/profile.php?id=127</uri>
			</author>
			<updated>2009-03-10T09:53:41Z</updated>
			<id>https://gprogs.com/viewtopic.php?pid=1396#p1396</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[how to rotate camera]]></title>
			<link rel="alternate" href="https://gprogs.com/viewtopic.php?pid=1393#p1393" />
			<content type="html"><![CDATA[<p>heres the code:<br /></p><div class="codebox"><pre><code>SuperStrict
Framework Irrlicht.Core



Local receiver:IEventReceiver=IEventReceiver.Create(MyEventReceiver.generate)

Local device:IrrlichtDevice = ..
    IrrlichtDevice.Create(EDT_DIRECT3D9, _DIMENSION2DI(640, 480), 16, ..
        False, False, False, receiver)
        Local driver:IVideoDriver = device.getVideoDriver()
Local smgr:ISceneManager = device.getSceneManager()
Local guienv:IGUIEnvironment = device.getGUIEnvironment()
Rem
We add a hello world label To the window, using the GUI environment.
EndRem
guienv.addStaticText(&quot;Hello World! This is the Irrlicht Software renderer!&quot;, ..
    _RECTI(10,10,260,22),True)
device.setWindowCaption(&quot;Hello World! - Irrlicht Engine Demo&quot;)

Local mesh:IMesh = smgr.getMesh(&quot;ship_models/11.b3d&quot;)


Global node:ImeshSceneNode = smgr.addmeshSceneNode(mesh)

Global globnode:Ilightscenenode=smgr.addlightscenenode()
Function TFormPoint:Vector3df(x:Float,y:Float,z:Float,source:ISceneNode,dest:ISceneNode)
    Local lastTForm:Vector3df=_VECTOR3DF(x,y,z)

    &#039; first convert to world from the source
    If source Then source.getAbsoluteTransformation().transformVect(lastTForm)

    &#039; now from world to local
    If dest Then dest.getRelativeTransformation().transformVect(lastTForm)
    
    Return lastTForm
EndFunction

If (node)
    node.setMaterialFlag(EMF_LIGHTING, False)
    &#039;node.setMD2Animation ( EMAT_STAND )
    node.setMaterialTexture( 0, driver.getTexture(&quot;ship_models\blueship-low.png&quot;) )
EndIf

Type MyEventReceiver Extends IEventReceiver
    Method OnEvent:Int(event:SEvent)
    
        If (node And event.getEventType()=EET_KEY_INPUT_EVENT And ..
            Not event.getKeyPressedDown())
            
            Local key:Int=event.getKeyInputKey()
                    
            Select key
                Case EKEY_KEY_W
                    Local v:Vector3df=node.GetRotation()
                    v.setY(v.getY()+2.0)
                    node.SetRotation(v)
                    Return True
                Case EKEY_KEY_S
                    Local v:Vector3df=node.GetRotation()
                    v.setY(v.getY()-2.0)
                    node.SetRotation(v)
                    Return True
                Default
                    Return False
            EndSelect
        EndIf

        Return False
    EndMethod

    &#039; we must override the generate function in order for instantiation to work properly
    Function generate:IEventReceiver()
        Return New MyEventReceiver
    EndFunction
EndType

Global camera:Icamerascenenode=smgr.addCameraSceneNode()&#039;(Null, _VECTOR3DF(0,30,-40), _VECTOR3DF(0,5,0))


Local i#
node.SetRotation(_vector3df(0,90,0))
While(device.run())

    driver.beginScene(True, True, _SCOLOR(0,0,0,140))


node.setposition(TFormPoint(0,0,10,node,globnode))
Local nodepos:vector3df=node.getposition()
Local noderot:vector3df=node.GetRotation()

camera.setposition(TFormPoint(0,0,15,node,globnode))
camera.SetRotation(noderot)

    smgr.drawAll()
    guienv.drawAll()

    driver.endScene()
Wend


device.drop()</code></pre></div><p>thing is, no matter what I change the camera rotation to.. it always points at the mesh, instead of pointing in the same direction as the mesh.</p><p>AND</p><p> if i put the camera behind the mesh it NEVER faces the ship</p><p>EDIT<br />nevermind I had to bind the cameras rotation and target</p>]]></content>
			<author>
				<name><![CDATA[Slenkar]]></name>
				<uri>https://gprogs.com/profile.php?id=40</uri>
			</author>
			<updated>2009-03-09T17:25:47Z</updated>
			<id>https://gprogs.com/viewtopic.php?pid=1393#p1393</id>
		</entry>
</feed>
