Camera for a game like Diablo

TaylorMouse

11-02-2010 12:59:36

Hey,

I can setup the camera, and bind it's movement to the keys ( arrow keys )
but when I pitch the camera to a nice position and then use the forward key and/or backwards key, it does not move in that direction, it actually move forward and backwards and not over the "world" -Z axis ?

I don't seem to figure out how the f... this works ?

anyone any ideas ?

thnx in advance

T.

smiley80

11-02-2010 13:44:40

Camera.Move uses the world's axes.
Camera.MoveRelative uses the camera's axes.

TaylorMouse

11-02-2010 14:52:44

Hey thnx, I haven't tried that one yet :)

I'll keep you posted

T.

TaylorMouse

18-02-2010 22:35:52

Yes !! I found it, I had to do the translation on the Node to which I attached the Camera, and not the camera itself :)

works like a charm

Now I have the node ( SceneNode ) move with the cameraNode, so that my character stays in the middle of the screen, but ...

If I use the arrows to move and my character needs to rotate in the correct direction, I already use Quaternians, Angles, etc... but it does not seem to turn in the right direction ?

any ideas ???

T.

AndroidAdam

20-02-2010 01:57:15

use node.Yaw(new Degree(1)) to rotate your character clockwise, and node.Yaw(new Degree(-1)) to rotate counter-clock wise.
You'll probably want to use a different number besides 1 depending on how fast you want your character.

TaylorMouse

21-02-2010 21:24:40

Hey, thnx, I found it already, by default it turns CCW ( Counter Clock Wise ) and what I did was something like this :

( in pseudo code )
if PlayerDirection == North
player.Yaw( 180 )
if PlayerDirection == South
player.Yaw( 0 )
if PlayerDirection == East
player.Yaw( 90 )
if PlayerDirection == West
player.Yaw( 270 )

but all that this was yaw the model undepending of what it's current yaw was :? and not turn it in that way so I made a little method that took care of that and changed the Yaw() method to something like player.YawToAngle( float angle )

And now it seems to be working :)

Next thing on my list... collision detection :mrgreen:

T.

Zonder

23-03-2010 12:49:31



Next thing on my list... collision detection :mrgreen:

T.


See here http://www.ogre3d.org/forums/viewtopic.php?f=5&t=56320 there was a port of this to c# somewhere