<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[GMan's Mods & Stuff — Camera as a parent to another object]]></title>
	<link rel="self" href="https://gprogs.com/extern.php?action=feed&amp;tid=182&amp;type=atom" />
	<updated>2007-04-10T02:14:32Z</updated>
	<generator>PunBB</generator>
	<id>https://gprogs.com/viewtopic.php?id=182</id>
		<entry>
			<title type="html"><![CDATA[Re: Camera as a parent to another object]]></title>
			<link rel="alternate" href="https://gprogs.com/viewtopic.php?pid=728#p728" />
			<content type="html"><![CDATA[<p>You can adjust the Offset vector to give distance from the player.<br />If you set Offset Z value you&#039;ll have more distance and Y more height.<br />Try setting the Distance value to a higher negative.<br /></p><div class="codebox"><pre><code>Local Offset:Vector3df = _VECTOR3DF( Slide, Height, Distance )</code></pre></div>]]></content>
			<author>
				<name><![CDATA[HondaDarrell]]></name>
				<uri>https://gprogs.com/profile.php?id=84</uri>
			</author>
			<updated>2007-04-10T02:14:32Z</updated>
			<id>https://gprogs.com/viewtopic.php?pid=728#p728</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Camera as a parent to another object]]></title>
			<link rel="alternate" href="https://gprogs.com/viewtopic.php?pid=725#p725" />
			<content type="html"><![CDATA[<p>Cool, but now I have another problem. Before I did this, the Camera was behind the<br />player object. Now the camera is exactly at the position of the player object.<br />Is there any way to move the camera backwards ?</p>]]></content>
			<author>
				<name><![CDATA[porcus]]></name>
				<uri>https://gprogs.com/profile.php?id=127</uri>
			</author>
			<updated>2007-04-09T17:40:28Z</updated>
			<id>https://gprogs.com/viewtopic.php?pid=725#p725</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Camera as a parent to another object]]></title>
			<link rel="alternate" href="https://gprogs.com/viewtopic.php?pid=722#p722" />
			<content type="html"><![CDATA[<div class="codebox"><pre><code>...
Type MyEventReceiver Extends IEventReceiver
Method OnEvent:Int(event:SEvent)
...
...

&#039;After updating the player you need to update it&#039;s absolute position
v=player.GetRotation()
v.setY(v.getY()+60.0)
player.SetRotation(v)
Player.updateAbsolutePosition()

...
...
EndMethod
...
EndType

...

&#039;Update Camera
Local M:Matrix4 = Matrix4.create()
Local Forward:Vector3df = _VECTOR3DF( 0, 0, 1 )
Local Up:Vector3df = _VECTOR3DF( 0, 1, 0 )
Local OffSet:Vector3df = _VECTOR3DF( 0, 5, -15 )

M.setRotationDegrees( Player.GetRotation())
M.transformVect( Forward )
M.transformVect( Up )
M.transformVect( OffSet )
OffSet = Offset.Plus( Player.getPosition())
Camera.setPosition( OffSet )
Camera.setUpVector( UP )
OffSet = OffSet.Plus( Forward )
Camera.setTarget( OffSet )
Camera.updateAbsolutePosition()</code></pre></div>]]></content>
			<author>
				<name><![CDATA[HondaDarrell]]></name>
				<uri>https://gprogs.com/profile.php?id=84</uri>
			</author>
			<updated>2007-04-07T23:28:46Z</updated>
			<id>https://gprogs.com/viewtopic.php?pid=722#p722</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Camera as a parent to another object]]></title>
			<link rel="alternate" href="https://gprogs.com/viewtopic.php?pid=721#p721" />
			<content type="html"><![CDATA[<p>If I use the camera as a parent to an other Object and I try to rotate it, the camera will not rotate correctly.</p><p>for example:</p><p>...<br />Type MyEventReceiver Extends IEventReceiver<br />Method OnEvent:Int(event:SEvent)<br />...<br />...</p><p>v=player.GetRotation()<br />v.setY(v.getY()+60.0)<br />player.SetRotation(v)</p><p>...<br />...<br />EndMethod<br />...<br />EndType</p><p>...<br />camera.setParent(player)<br />...</p><p>Why ?</p><p>(Excuse me for my bad English.)</p>]]></content>
			<author>
				<name><![CDATA[porcus]]></name>
				<uri>https://gprogs.com/profile.php?id=127</uri>
			</author>
			<updated>2007-04-07T16:52:55Z</updated>
			<id>https://gprogs.com/viewtopic.php?pid=721#p721</id>
		</entry>
</feed>
