Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: Nog on June 02, 2014, 12:36:45 PM

Title: Camera Collision
Post by: Nog 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
Title: Re: Camera Collision
Post by: vonpopov 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.
Title: Re: Camera Collision
Post by: Nog 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
Title: Re: Camera Collision
Post by: TrentSterling 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.
Title: Re: Camera Collision
Post by: Nog 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