A Flash Developer Resource Site

Results 1 to 8 of 8

Thread: Away3d simple third-person camera

  1. #1
    Senior Member
    Join Date
    Sep 2008
    Posts
    100

    Unhappy Away3d simple third-person camera

    Ok I will be point blank about this. I want a following camera in away3d scene that looks at an object.

    What I want the aspects of it to be is simple.

    I would want it to not move left and right when you click on keys to move left and right. But just stay put and have the character alone move right.

    But when you press keys to move forward in backward it moves at the same angle the character moves. Just a typical third person camera. Nothing to hard, Its just that I have been trying to do this for a long time and have yet to figure out how!

    For an example of what I want, if you have ever played Jak and Daxter the Precurser Legacy. I want it to be something like that style. Doesn't move left and right. Just forward and backward along the angle it is facing, which would be the direction where your character is.

    Can anyone point me out on how I would get this done?, Please someone help!

  2. #2
    Senior Member
    Join Date
    Jun 2002
    Location
    Manchester, UK
    Posts
    2,357
    Have your character at a point, move the camera with that point, rotate the camera around that point based on the rotation angle of your character ( basic trig ). Now point the camera at your character.

    RipX

  3. #3
    Senior Member
    Join Date
    Sep 2008
    Posts
    100
    Quote Originally Posted by RipX View Post
    Have your character at a point, move the camera with that point, rotate the camera around that point based on the rotation angle of your character ( basic trig ). Now point the camera at your character.

    RipX
    For 1:
    I don't want to rotate the camera around him, more or less I want him to be user controlled to rotate around the camera. Sort of...

    Basically just the ability to have the camera move forward in the same direction the player is going.

    For 2:
    I don't know that much about the application of trig... Sorta am only a high school sophomore and I haven't taken it.

  4. #4
    Senior Member Pazil's Avatar
    Join Date
    Sep 2006
    Location
    Ontario, Canada
    Posts
    913
    Simply use:

    camera.x = player.x;
    camera.y = player.y + 50;
    camera.z = player.z - 50;

    Or something...that should get the camera to move along with the character?
    WIP-ZOMBIES

    I love vegetarians! More meat for the rest of us!

  5. #5
    Senior Member
    Join Date
    Sep 2008
    Posts
    100
    Quote Originally Posted by Pazil View Post
    Simply use:

    camera.x = player.x;
    camera.y = player.y + 50;
    camera.z = player.z - 50;

    Or something...that should get the camera to move along with the character?
    Would have to be more than just that (need both x and z to be calculated with some form of trig equation, other wise it will only follow the player though the z)

  6. #6
    Senior Member Pazil's Avatar
    Join Date
    Sep 2006
    Location
    Ontario, Canada
    Posts
    913
    Then I am really confused at what you are trying to get...You don't want the camera to rotate, but you want it to follow him? That code modifies all 3 axis!
    WIP-ZOMBIES

    I love vegetarians! More meat for the rest of us!

  7. #7
    Senior Member
    Join Date
    Sep 2008
    Posts
    100
    Quote Originally Posted by Pazil View Post
    Then I am really confused at what you are trying to get...You don't want the camera to rotate, but you want it to follow him? That code modifies all 3 axis!
    I want the camera to look at the player. I want him to move left and right, but the camera doesn't move left and right, just looks at the player. And I want the camera to move forward and backward with the player through the detected angle found between the camera and the player.

    The camera only looks at him, and moves forward and backward at the same speed as him. Doesn't move left and right.

  8. #8
    Senior Member
    Join Date
    Jun 2002
    Location
    Manchester, UK
    Posts
    2,357
    Quote Originally Posted by cody112 View Post
    For 1:
    I don't want to rotate the camera around him, more or less I want him to be user controlled to rotate around the camera. Sort of...

    Then explain better

    Basically just the ability to have the camera move forward in the same direction the player is going.

    For 2:
    I don't know that much about the application of trig... Sorta am only a high school sophomore and I haven't taken it.
    Then learn it

    RipX

Tags for this Thread

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

HTML5 Development Center