Results 1 to 4 of 4

Thread: 3rd person... help :?

  1. #1

    Thread Starter
    Frenzied Member Devion's Avatar
    Join Date
    Sep 2000
    Location
    The Netherlands
    Posts
    1,049

    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

  2. #2
    Good Ol' Platypus Sastraxi's Avatar
    Join Date
    Jan 2000
    Location
    Ontario, Canada
    Posts
    5,134
    Look up polar coordinates. They are essential for a 3rd-person camera view.
    All contents of the above post that aren't somebody elses are mine, not the property of some media corporation.
    (Just a heads-up)

  3. #3
    Frenzied Member Zaei's Avatar
    Join Date
    Jul 2002
    Location
    My own little world...
    Posts
    1,710
    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.

  4. #4

    Thread Starter
    Frenzied Member Devion's Avatar
    Join Date
    Sep 2000
    Location
    The Netherlands
    Posts
    1,049
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width