playMaker

Author Topic: Camera Collision  (Read 2858 times)

Nog

  • Playmaker Newbie
  • *
  • Posts: 47
Camera Collision
« on: June 02, 2014, 12:36:45 PM »
Hello Playmaker Forum,

I have just finished the 3rd person camera tutorial from the Hutong Games video tutorials. It is a good 3rd person camera system; however, this camera setup does not prevent the camera from going through walls and other obstacles. How would I go about building a camera collision system into this setup using Playmaker so that the camera does not go through walls and other objects? Any ideas?

Thank you for your help.

Thanks,

Nog
« Last Edit: June 02, 2014, 12:40:08 PM by Nog »

vonpopov

  • Junior Playmaker
  • **
  • Posts: 98
Re: Camera Collision
« Reply #1 on: June 04, 2014, 12:16:14 PM »
make you camera have a parent. This parent would be your actual camera position.

When it collide, your camera can not goes in.
Make a state when your camera position is not matching its parents position, it try to reach that position ;) (using iTween)

I suggest you to prevent that state (reach position) to do anything when your character is not moving anymore (to avoid some shaking problem)

that is how i would handle that ;)
this is simple, you can do more complicated things.

Nog

  • Playmaker Newbie
  • *
  • Posts: 47
Re: Camera Collision
« Reply #2 on: June 05, 2014, 05:58:40 PM »
Hello vonpopov,

Thank you for the reply. I will give this setup a try. Again, thank you for your help.

Nog

TrentSterling

  • Junior Playmaker
  • **
  • Posts: 89
  • Someday I'll make games!
    • My Blog
Re: Camera Collision
« Reply #3 on: June 06, 2014, 02:52:12 PM »
Raycasting would be your next bet- but I'm not sure that's as easy to explain. You should cast a ray from your player's head to your camera point- and position the camera at the ray's length, or intersection.

Nog

  • Playmaker Newbie
  • *
  • Posts: 47
Re: Camera Collision
« Reply #4 on: June 10, 2014, 02:09:25 PM »
Hello TrentSterling,

Thank you for the reply. Are there any tutorials or examples that you could direct me toward? I will give your advice a try.

Thanks,

Nog