Unity Community


Results 1 to 3 of 3

  1. Location
    Minnesota, USA
    Posts
    1,713

    Smooth Chase Camera for Terrain

    I have an idea for a camera tracking behavior that I am looking for hints on implementing:

    I'd like to apply a force to the camera as a linear function (with a defined maximum force) dependent on the camera's current position to this point:

    This point would move to be a specified distance from its target in whatever direction it needs to do so. Additionally, it would use something similar to the "Place Object On Surface" menu item to furthur position the point. Then it would offset the point by a defined "elevation" variable.

    The effect should be a smooth chase camera that follows terrain and never goes through objects.

    After writing this now, I see it would be a problem for any tall objects on the terrain, like trees.

    Can anyone offer some hints at what sections of the Script Reference would be good to look at for this? Or a better approach is most certainily welcome.

    I guess what I'm looking for is "lazy" object parenting with collisions, so you never go under the terrain in an ugly way.

    Thanks
    -Jon


  2. Location
    Unity Technologies HQ, Copenhagen
    Posts
    3,514
    * Don't use rigid bodies to create a follow camera
    * Take a look at the ray cast functions in dynamics. Cast a ray downwards, to find the intersection with the terrain. Using Debug.DrawLine can save you a lot of time when debugging.
    * Quaternion.Slerp, Quaternion.FromToRotation, Quaternion.AxisAngle, Quaternion.LookRotation are your friends.

    * That said, I am going to add a sample script for follow camera to one of the next beta releases.

    Making a good follow camera that works in all cases is a hard problem. I'll try to make the follow camera as good as possible.
    Joachim Ante


  3. Location
    United States
    Posts
    1,088
    Experienced Unity developer, currently looking for work!

    http://forum.unity3d.com/threads/184...Tate-McCormick

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •