Can any write me an example of 3rd Person in c#

Irrlicht.Net is no longer developed or supported, Irrlicht.Net Cross Platform is a much more complete wrapper. Please ask your C# related questions on their forums first.
Locked
jurisekvendov
Posts: 7
Joined: Wed Apr 12, 2006 10:26 pm

Can any write me an example of 3rd Person in c#

Post by jurisekvendov »

Hello Irrlicht Users / Programmers

Can any one help me with a test application in c# with 3rd person follow like in fps just like 3rd person.


Best regards
Juri Sekvendov
DeusXL
Posts: 114
Joined: Sun Mar 14, 2004 9:37 am
Contact:

Post by DeusXL »

What do you need ?

If it's positioning the camera behind the player then you should take a look to ISceneNode.AbsoluteTransformation.get_M(x, 0); where x is a number from 1 to 3... For instance a position behind the player can be :

Code: Select all

            Matrix4 mat = PlayerNode.AbsoluteTransformation;
            float m_cameradistance = -100f;
            Vector3D pos = PlayerNode.Position;
            pos += new Vector3D(mat.get_M(0, 0) * m_cameradistance,
                                mat.get_M(1, 0),
                                mat.get_M(2, 0) * m_cameradistance);
             Camera.Position = pos;
If you just need to move the player, then the same can be used (with a "m_cameradistance" positive).

Be more precise on what you need please...
Irrlicht .NET complete and Cross Platform Wrapper
The kid on my avatar wrote:A painless lesson is one without any meaning
groats
Posts: 7
Joined: Tue Mar 21, 2006 11:49 am

Post by groats »

how about making the Camera a child of the target node ( your character )
something like:

Code: Select all


ISceneNode target; /* SceneNode to Chase */

Camera.Position = new Vector3D(0, 150, -250);
Camera.Target = target.Position;
target.AddChild(cam);
just adjust the x,y,z of the vector to position your camera optimally

you also need a focus to keep the camera looking at the target

Code: Select all

        private void FocusCamera(IScenenode theTarget)
        {
             cam.Target = theTarget.Position;            
        }
You should call this regularily, say in your main device.Run() loop. This keeps you looking in the targets direction no matter how it is moved.
You don't need to change the cameras position since being a child it will just follow the Target Node automatically.
Locked