Jump to content

Third person camera discussion


AggrorJorn
 Share

Recommended Posts

This is more of a discussion then a question.

 

I have been working with Third person implementation for severall purposes. After trying a couple of things there are a couple of 'wonderings'.

 

The easiest way of a TPC:

  1. position the camera at the characters position.
  2. parent the camera to the character
  3. move the camera backwards

The approach discribed above works but has a major flaw which is not directly obvious. Everything works fine untill for example you come across a waterplane. Then you will notice the waters reflection is not correctly updated.

 

This is because you parent the framework camera (main.camera) to the character and not the other 2 camera's (background and foreground). Okay, that sounds logical to me.

One could say that besides the main camera parenting to the character, you could also parent the other 2 camera's to the character. Haven't been able to get that working so far.

 

 

A second way of the TPC is:

  1. Place a pivot at the character
  2. Then inside the main loop you:
  3. Get the pivot's position and place the camera on that position.
  4. Get the pivot's rotation and add it to the camera rotation.
  5. Move the camera backwords for the offset.

This solves the problem of the water reflection but this makes wonder why this works instead of the parenting. At the moment the main camera position and rotation are being updated but the other 2 camera's are not, right? Why is this working then and why not the parenting where we are also talking about 1 camera?

Link to comment
Share on other sites

Parenting has many of those problems you describe (problems with rendering, problems with animations, problems with physics, etc...), so in most cases it's better to use SetEntityMatrix/GetEntityMatrix to simulate parenting.

 

Usually I parent first, then see if it works, and it not, then I use SetEntityMatrix/GetEntityMatrix and continue with the game development.

Ryzen 9 RX 6800M ■ 16GB XF8 Windows 11 ■
Ultra ■ LE 2.53DWS 5.6  Reaper ■ C/C++ C# ■ Fortran 2008 ■ Story ■
■ Homepage: https://canardia.com ■

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...