Posted By: Ruben
Camera collision - 06/14/13 21:50
I am trying to make the camera that follows behind my player character not go behind walls. For example, lets say I rotate my character next to a wall (with the camera behind the character, facing where the character is facing). Instead of moving along the wall and constantly viewing the character's back (even closing up to the character's back if need be), the camera goes behind the wall instead, so that I cannot see my character's back, or where the character is facing; only the other side of the wall that my character is next to.
Does anyone know of a function or technique to have the camera behind the character move along walls as the character turns, instead of go through them, so that I can always see character's back and facing direction at all times?
Posted By: Superku
Re: Camera collision - 06/14/13 21:59
This question as well as your last one are better off in the "Starting with Gamestudio" section.
What you can do is trace from the player position to the wanted/ calculated camera position and if trace_hit then set the camera at the target location (or a little closer to the player).
Posted By: Anonymous
Re: Camera collision - 06/15/13 00:02
Superku's post is the common way I do it. This is covered many times a year on the forum and I'm sure the AUM has answered it a bunch also And maybe the wiki. Try building a function and if you have problems with it then start a new post in the section Superku told you about and someone will probably try and help. You will get better replys if you post the code to a function and ask for help then asking someone to build a function for you.
@Superku - Just wondering if you have ever placed the camera inside a invisible entity and used c_move and GLIDE and a little logic. Just curious before testing if there is major flaw with this method.
EDIT - Thanks Superku
Posted By: Superku
Re: Camera collision - 06/15/13 00:06
Many many years ago I've used an entity and c_move for this but it does not have any advantages (at least I cannot think of any) over using a c_trace (optionally with USE_BOX) method.