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
Can any write me an example of 3rd Person in c#
-
- Posts: 7
- Joined: Wed Apr 12, 2006 10:26 pm
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 :
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...
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;
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
how about making the Camera a child of the target node ( your character )
something like:
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
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.
something like:
Code: Select all
ISceneNode target; /* SceneNode to Chase */
Camera.Position = new Vector3D(0, 150, -250);
Camera.Target = target.Position;
target.AddChild(cam);
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 don't need to change the cameras position since being a child it will just follow the Target Node automatically.