-
3rd person... help :?
I dont want to admit it but i'm stuck ;)
--
I want to see my character in third person, and I succeeded in playing the camera at the right angle, but I have no clue how interpreter the x,y,z's and how to make things go smooth..
Just to keep things a bit clear for readers:
I've got the following functions available (and can create more if needed but I presume this is all I need)
* Getting/Setting the X,Y,Z of the camera (locational)
* Getting/Setting the X,Y,Z of the player (locational)
* Rotational info for both (and setting it)
code example:
Code:
' init
PlayerModel.Set_Position plX, plY, plZ
PlayerModel.Set_Rotation 0, 1, 0
' this ones in the main render loop
Nemo.Camera_SetPosition Vector(87 + plX, 220 + plY, 114 + plZ), Vector(plX, plY, plZ)
plX = X of player.
plY = Y of player. (which doesn't change, there aren't any height differences on the map)
plZ = Z of the player.
I know the setposition of the camera is wrong, but heck, it worked for now :)
so if anyone can help me out with this problem or has some source available that can help me fix or solve this problem...
(I suck at 3d maths btw :)
-
Look up polar coordinates. They are essential for a 3rd-person camera view.
-
Well, youve got a rotation for the player, so its fairly simple. Convert the rotation into a direction vector, and normalize it, and multiply it by -1. Then for the position of the camera, its just dir_vec * dist_from _player + player_pos. This will place the camera at a position that is opposite the direction that the player is looking, and behind. You cant hen just set the camera to look at the player model, and you are all set.
Z.
-
Okay..
but how do I let the playermodel walk to a certain direction.
I can only set the x,y,z... and I keep the 'angle' of the rotation.
If plDirection=90 then x=x+1:confused: