playMaker

Author Topic: How to setup a 3rd Person Camera that collides with walls?  (Read 2159 times)

Adam Z

  • Full Member
  • ***
  • Posts: 207
How to setup a 3rd Person Camera that collides with walls?
« on: October 21, 2015, 10:37:16 AM »
Does anyone have any good resources that will help me figure out a camera system that take into account collision, say your player backs into a wall... instead of clipping through the wall, I would like it to move closer to the play and up while looking down if the player is right up against the wall.  Thanks!

Nog

  • Playmaker Newbie
  • *
  • Posts: 47
Re: How to setup a 3rd Person Camera that collides with walls?
« Reply #1 on: October 23, 2015, 12:19:12 AM »
Hello Adam Z,

You should look into the raycast action. It will allow you to cast a ray in any direction from a game object. You can store information like when a collision has occurred, distance, and what object the ray hit.

As a result, you can detect when the camera collides with walls. Once the ray detects that a collision has occurred, you can tell your camera to stop rotating, move closer, move farther away, etc.

Here are some videos to get things started:
Playmaker - Basic Raycasting
Playmaker - Basic Raycasting Pt.2
This is a great series on artificial intelligence, but it also features some very clever use of raycasting:

Nog


« Last Edit: October 23, 2015, 12:50:45 AM by Nog »