Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 21 Jun 2011
Offline Last Active May 08 2016 04:16 AM

Posts I've Made

In Topic: 3rd person camera in DirectX

08 August 2011 - 02:02 AM


In Topic: 3rd person camera in DirectX

07 August 2011 - 07:27 AM

Hi Aaron,

Basically what you need to do is the same for ANY object you need to rotate around a point. This is accomplished by moving your object in such a way that the pivot point (in your case the character) is at the origin when you are rotating. Basically you do this:

  • Translate object with object.position - pivot
  • Rotate object with your rotation (position transformation can be included in this operation)
  • Tranlate object back with object.position - pivot
As others here have suggested you might also want to do other fancy things as making camera bobbing/smooth movement, but as long as you rotate the camera in its local coordinate system, with the steps I posted it will at least be focused on your pivot point.

Also, there is no problem at all in using C#. It is merely different from C++, but it is not inherintly worse. Fyi ryan, I think you might be talking about GC.SuppressFinalize.

I am trying your way and this is what I've got for when I press < arrow.

        public void mRotateCamera(float angle,float speed, dev.Device d)
            Vector3 old = cha.position;
            cha.position = new Vector3(0, 0, 0);
            d.Transform.World = Matrix.RotationY(10);
            cha.position = old;

This will not work, It wont rotate the camera around the Y axe.

It just stays at {old}

In Topic: 3rd person camera in DirectX

07 August 2011 - 07:15 AM

G,day all,
I know that this is sort of an old topic, but I have been very busy at school with exams and my computer crashed. I have lost a lot of knowledge about all of this and have just started construction of my DirectX adventures again. Now I have it to the point were I have the character loaded (.X file) and have the camera positioned so that the Camera is looking behind and down on the mesh. Now I just need to clarify some things with you. In order to get a simple 3rd person camera operating, I need to move the character to the origin {0,0,0} and rotate the camera around it to X amount and then send it back to the old position? But wont this make the scene objects (buildings ect) move as well, I mean say the character was at {100,0,200} and then I move him to {0,0,0} wont this make me watch it as he travels to the origin?