2 replaced http://gamedev.stackexchange.com/ with https://gamedev.stackexchange.com/
source | link

Well, I'd suggest to use Smooth Follow script rather than making it child (if it is not particularly required).

  • You can grab the Camera Follow code from this answerthis answer

  • Attach it to your camera (please un-child your camera first)

  • Drop the initial target in Target in just attached Smooth Follow script.

  • Access this script in your current script in which you want to play with it. (By public SmoothFollow smoothFollw; or by FindObjectOfType< SmoothFollow>() whatever you want)

  • Now change the target on collision by changing its target transform value.

Hope this helps.

Well, I'd suggest to use Smooth Follow script rather than making it child (if it is not particularly required).

  • You can grab the Camera Follow code from this answer

  • Attach it to your camera (please un-child your camera first)

  • Drop the initial target in Target in just attached Smooth Follow script.

  • Access this script in your current script in which you want to play with it. (By public SmoothFollow smoothFollw; or by FindObjectOfType< SmoothFollow>() whatever you want)

  • Now change the target on collision by changing its target transform value.

Hope this helps.

Well, I'd suggest to use Smooth Follow script rather than making it child (if it is not particularly required).

  • You can grab the Camera Follow code from this answer

  • Attach it to your camera (please un-child your camera first)

  • Drop the initial target in Target in just attached Smooth Follow script.

  • Access this script in your current script in which you want to play with it. (By public SmoothFollow smoothFollw; or by FindObjectOfType< SmoothFollow>() whatever you want)

  • Now change the target on collision by changing its target transform value.

Hope this helps.

1
source | link

Well, I'd suggest to use Smooth Follow script rather than making it child (if it is not particularly required).

  • You can grab the Camera Follow code from this answer

  • Attach it to your camera (please un-child your camera first)

  • Drop the initial target in Target in just attached Smooth Follow script.

  • Access this script in your current script in which you want to play with it. (By public SmoothFollow smoothFollw; or by FindObjectOfType< SmoothFollow>() whatever you want)

  • Now change the target on collision by changing its target transform value.

Hope this helps.