Quick question about 3rd person models

Started by
6 comments, last by mrbastard 18 years, 10 months ago
Excuse the n00b question but to date I have been programming my 3rd person game where as the player object follows the camera. Is this the best way to do it or should the camera be following the object? Finally if the camera is supposed to be drawing the object then how do you determine the view vector for the model? I'm just looking for some theories here on the best way to get the job done. Thanks!
Advertisement
You currently have it backwards, the camera should be following the player and making adjustments for height, etc along the way. The camera doesn't draw the object, the object is just an entity in the scene, the camera just follows that specific entity.
When you turn, does the camera turn and the player run over to get in front of it, or does the player turn and the camera move to get behind him? I guess that determines if you should have the camera follow the player or vice versa.
John BoltonLocomotive Games (THQ)Current Project: Destroy All Humans (Wii). IN STORES NOW!
Thank you for the thoughts...Right now the camera moves through the world and then is moved to the camera x and z position every time the scene is rendered using gltranslatef. Then I calculated the angle of rotation whenever my camera moves and applied that to the model. It seems kind of convulted but it works. However, I have to figure out how to do it the other way I guess if I ever want to get other players in there :)

Here is my question. I have a MD2 or 3DS model or whatever and I load it into the arena that I have. When the player model is loaded in how do I know what direction it is facing for movement? In other words for movement I have to figure out which way the model is facing and then somehow get its view vector to make it walk that direction. Is there some sort of algortihm that is standard out there to make this happen?

To date this is why I had the model following and rotating the camera. I couldn't find any good resources on how to make it go the other way. Any assistance is appreciated...Thanks!
Quote:Original post by JohnBolton
When you turn, does the camera turn and the player run over to get in front of it, or does the player turn and the camera move to get behind him? I guess that determines if you should have the camera follow the player or vice versa.


No, at least not in my opinion. The player should be an entity and the camera follows it if built properly. If you want the camera to move behind or lag behind the character than you would perform those calculations on the camera, same goes for player lag. There is no reason at all to have the player follow the camera or to have the camera draw the player.. unless there is an example I am missing out on here?

I will try and get some time later today for a better response to the next post, I just have to run right now, time to go home :)
"Logically" I think most people can better grok the idea of the camera following the entity in question. it simply makes more sense when paired with our view of how the world (real or virtual) works. If you're filming a movie, you don't strap your actor to the camera, you have the camera follow him.

"Technically," however, you will get the same visual effect with either method. It's rather like setting up a camera in openGL. Since there is no seperate "view" matrix like D3D, you have to think in reverse. Want to move your camera left? Move your entire scene right. It's slightly counterintuitive, but if implemented correctly no one can tell the difference.

I would simply consider what your needs for the system are:

Is your camera going to constantly follow a single entity, or do you need it to be able to switch? If the latter you probably want a independant camera that you can assign to follow any entity.
Are other people going to be working on your code? In a multiple programmer environment it's usually best to stick to standards.
How is your scene graph set up? Your collision detection? The very structure of your engine may dictate one method or the other.
// The user formerly known as Tojiro67445, formerly known as Toji [smile]
I would like to thank everyone for their time. Really the only reason I've been doing 3rd person perspective in the way I am now is because I referenced a 3rd person perspective tutorial out on GameTutorials and they hinted that was one good way to do it. I built a lot of my engine around that theory but I am starting to see some limitations that I need to get around and I think by having the camera follow the object I would be able to get around those limitations. I played with it some this afternoon and I am already having some success flipping it around the other way but there are a few kinks I need to work out yet.

I may run into a question or two as I do it so hopefully you all will have some insight for me. This thread was helpful, thanks!

Mark :)
Quote:Original post by rm2000When the player model is loaded in how do I know what direction it is facing for movement? In other words for movement I have to figure out which way the model is facing and then somehow get its view vector to make it walk that direction. Is there some sort of algortihm that is standard out there to make this happen?


Most models start off facing down the positive z axis, but it's just down to however they were positioned in the editor. So there's no way to be certain except to agree with your team to do it a certain way (or use whatever is most standard for the files you are using).

[size="1"]

This topic is closed to new replies.

Advertisement