About Store Forum Documentation Contact
Donations:
345$/mo



Post Reply 
Third person shooter camera
Author Message
Aniketos Offline
Member

Post: #1
Third person shooter camera
I'm trying to make a camera just like in Mass effect 2 which basically sticks to the right shoulder of the character while aiming.

Here is a small video showing how the camera looks like: http://www.youtube.com/watch?v=yi8W1kQG0Vo

Anyway back to coding I was trying to make it with available options like cam.setspherical, cam.setangle, cam.posdir etc but they don't produce the right view.

The closest that came to making it look correct was cam.setspherical but instead of turning the camera.yaw around an axis its doing an arc basically. So at a sertain angle the camera looks look from the right shoulder but lets say I turn 180 degrees the camera moves to the left shoulder etc.

Any idea's how I could make it work.
05-05-2011 12:48 PM
Visit this user's website Find all posts by this user Quote this message in a reply
evldmn Offline
Member

Post: #2
RE: Third person shooter camera
Get the third person camera from the tutorial and place it with an offset from the character.
05-10-2011 11:45 AM
Find all posts by this user Quote this message in a reply
Aniketos Offline
Member

Post: #3
RE: Third person shooter camera
You obviously didn't get the question or didn't try it yourself...
05-10-2011 07:30 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Driklyn Offline
Member

Post: #4
RE: Third person shooter camera
I think you misunderstood evldmn, Aniketos. He is correct. That is just a TPP camera with an offset from the player's position.

Sounds to me like you're not taking into account the player's rotation. Example:

Code:
Vec offset = Vec(1, 1, 0);
Cam.setSpherical(Players[0].pos() + offset, ..);

This is incorrect. This will force the offset to always be +1 on the X-axis, which is wrong when you turn the character.

You need something like this to take into account of the player's rotation:

Code:
Vec offset = Vec(0);
if (OrientP *p = Players[0].cskel.findPoint((Str8)"Head")) offset = p->cross() * 0.25f;

Cam.setSpherical(Players[0].pos() + Vec(offset.x, 1, offset.z), ..);
(This post was last modified: 05-10-2011 08:28 PM by Driklyn.)
05-10-2011 08:27 PM
Find all posts by this user Quote this message in a reply
Aniketos Offline
Member

Post: #5
RE: Third person shooter camera
Yeah, got something like that working atm tnx for the info.
05-11-2011 05:50 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Post Reply