Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

3rd Person Camera - emulating the World of Warcraft camera with Smart Pivot and Thickness Checks

Discussion in 'Assets and Asset Store' started by Enzi, Feb 3, 2016.

  1. Enzi

    Enzi

    Joined:
    Jan 28, 2013
    Posts:
    186

    If you're looking for an easy to use 3rd person camera that emulates cameras in AAA productions like World of Warcraft and Guild Wars 2 look no further!

    The main feature points of this asset are:
    • Occlusion Checking
      A spherical collision algorithm makes sure the camera doesn't clip into any geometry and repositions itself when the target is obstructed.
    • Smart Pivot

      Sets a pivot point when the camera is hitting the ground while looking up and prevents the character from blocking the view.
    • Thickness Checking Thickness checking can be configured to ignore smaller obstacles like sticks, trees, etc... to not reposition or zoom in the camera.
    • Controller support
    Its flexibility also allows to implement different camera modes. For example, over-the-shoulder type of games like Dark Souls.
    Also it has no other script dependencies, is easy to configure and open source.

    Assetstore: https://www.assetstore.unity3d.com/en/#!/content/47601
    Documentation: http://bit.ly/1p2BTSi
    Beta: http://www.enzenebner.com/beta
    WebGL Demo: http://enzenebner.com/camera/
    !Attention! The WebGL version has a glitch with mouse locking. If you don't press any key while the mouse is hidden it will leave the window.
     
    Last edited: Apr 5, 2019
  2. Enzi

    Enzi

    Joined:
    Jan 28, 2013
    Posts:
    186
    As part of the 1.0.3 update I added an automatic follow mode. It works without any manual camera handling and is designed for something like handling a car, tank, plane, etc...

    The slope alignment works best with non-humanoid characters.

    Here's a demonstration:


    With 1.0.3 it will be built-in. For now, here's the code to extend the 3rd person camera.
    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3.  
    4. public class Follow : MonoBehaviour
    5. {
    6.     public bool follow = true;
    7.     public bool alignOnSlopes = true;
    8.     CameraController cc;
    9.  
    10.     void Start()
    11.     {
    12.         cc = GetComponent<CameraController>();
    13.     }
    14.  
    15.     void Update()
    16.     {
    17.         if (follow)
    18.         {
    19.             RaycastHit raycastHit;
    20.             Vector3 upVector = Vector3.up;
    21.  
    22.             Quaternion toRotation = Quaternion.LookRotation(cc.target.transform.forward, Vector3.up);
    23.  
    24.             if (alignOnSlopes)
    25.             {
    26.                 if (Physics.Raycast(cc.target.transform.position, Vector3.down, out raycastHit, 15.0f, (1 << 0))) // if the range of 15.0 is not enough, increase the value
    27.                 {
    28.                     upVector = raycastHit.normal;
    29.                 }
    30.  
    31.                 float angle = AngleSigned(Vector3.up, upVector, cc.target.transform.right);
    32.  
    33.                 toRotation = toRotation * Quaternion.AngleAxis(angle, Vector3.right);
    34.             }
    35.  
    36.             cc.transform.rotation = Quaternion.Slerp(cc.transform.rotation, toRotation, Time.deltaTime);
    37.         }
    38.     }
    39.  
    40.     public float AngleSigned(Vector3 v1, Vector3 v2, Vector3 n)
    41.     {
    42.         return Mathf.Atan2(
    43.             Vector3.Dot(n, Vector3.Cross(v1, v2)),
    44.             Vector3.Dot(v1, v2)) * Mathf.Rad2Deg;
    45.     }
    46. }
     
    Last edited: Feb 16, 2016
  3. Enzi

    Enzi

    Joined:
    Jan 28, 2013
    Posts:
    186
    1.0.3 was submitted and will be soon released on the asset store!
    It's a bulky update, with 2 new demo scenes that feature an auto follow demonstration with a car and a freeform camera plus lock-on targeting. 2 features that were much requested.

    Thickness check and smart pivot, 2 features that are still unique to any other camera on the asset store also got improved further.

    With the new features and changes I'm also upping the price to 25$. So if you were interested before, grab it will it's 10$ cheaper!

    As mentioned in my initial post you can always get an up-to-date version of the WebGL demo, featuring the 2 new scenes.
    I also made some videos demonstrating everything the asset has to offer.

    Freeform camera demonstration:


    Follow mode:


    Freeform + lock-on targeting
     
  4. Enzi

    Enzi

    Joined:
    Jan 28, 2013
    Posts:
    186
    1.0.3 has been released!
     
  5. Enzi

    Enzi

    Joined:
    Jan 28, 2013
    Posts:
    186
    1.0.4 is in the works with the following changes:

    - added smart DisableFollow script to utilize FreeForm + Follow
    - added Ball demo scene (not playable right now in WebGL)
    - added simple BallController script
    - added namespace to scripts
    - improved smart pivot transition from sloped surfaces
    - improved smoothness of alignToSlopes feature
    - improved camera when target offset clips into geometry
    - restored Ethan crouch animation
    - removed Ethan air->ground crouch animation

    While I'm setting an automated process up to get access to betas, you can send me an email with your invoiceID to verify.
    When it's done the betas can be found on: http://www.enzenebner.com/beta
     
    Last edited: Mar 5, 2019
    Bhanshee00 likes this.
  6. mayrag0005

    mayrag0005

    Joined:
    Aug 24, 2018
    Posts:
    1
    how to make a programming
     

    Attached Files:

  7. Enzi

    Enzi

    Joined:
    Jan 28, 2013
    Posts:
    186
    I'm currently updating the 3rd person camera asset with some new features:
    - smooth target following with speed value
    - additional camera offset to better emulate over the shoulder type of games which have their pivot not around the character

    On the horizon is an update to make use of ECS and the ability to use multiple cameras but that's a feature I'm not sure is even wanted. Let me know in any case.

    edit: I'm sorry for the broken Youtube links. Something seems to be going on in the forum.
     
  8. hendrikk1

    hendrikk1

    Joined:
    Aug 7, 2012
    Posts:
    12
    Hi Enzi,

    Your asset works well in my game, thanks for making it! But since you're planning to update it with the additional camera offset like you mentioned, when will it be ready to download ?
     
  9. Enzi

    Enzi

    Joined:
    Jan 28, 2013
    Posts:
    186
    Hey Hendrik!
    I just came back from a business trip, otherwise I would've replied sooner.
    I'll make the beta package available the next days or this weekend. There's a hiccup I need to iron out with the camera offset and smart pivot enabled. Other than that it's already working.
     
  10. hendrikk1

    hendrikk1

    Joined:
    Aug 7, 2012
    Posts:
    12
    Thanks for the reply, Enzi, let me know when the beta ready :D
     
  11. Enzi

    Enzi

    Joined:
    Jan 28, 2013
    Posts:
    186
    1.0.5 is now available
    You can find it with this link and your OR number: http://www.enzenebner.com/beta
    The OR number is found in the Unity receipt when purchasing the camera.

    1.0.5 brings the following changes and features:
    - added additional camera offset vector for skewed over-the-shoulder camera type of games like "The Division"
    - changed PlayerLayer data type to LayerMask
    - added "Smooth Target Mode" and "Smoothing speed" that lerps to the target position for smoother translations/rotations
    and to dampen noisy position changes
    - added new scene to demonstrate Camera Offset

    I'll provide a short video to show off the new camera offset as it's easier to understand what this really means. Basically the pivot is usually at the characters head but for over-the-shoulder games the pivot is actually in the middle of the screen with the character to the side.
    With the new camera offset vector this can be changed easily now. Before, when you moved the offset to the left or right it ended in odd rotations that were not good for such a type of camera or game.

    I hope that is fixed now and the camera support even more games.
    I'll test further and if everything is alright the package gets submitted to the store.
     
    Last edited: Mar 30, 2019
  12. hendrikk1

    hendrikk1

    Joined:
    Aug 7, 2012
    Posts:
    12
    Hi Enzi,
    Thanks for the update, for the OR number, is it the one with '#' character at first or with 'IN' ?
     
  13. Enzi

    Enzi

    Joined:
    Jan 28, 2013
    Posts:
    186
    Sadly there's a problem with the beta access. New order numbers from the store don't work anymore and I've to find a new solution and rewrite the backend.
    In the meanwhile, for anyone interested, send me a PN or an email with your reciept and I'll give you access.

    edit: Beta access if fixed now
     
    Last edited: Apr 5, 2019
  14. digitalzombie

    digitalzombie

    Joined:
    Dec 10, 2007
    Posts:
    68
    Great camera! I purchased last night and within an hour or so had exactly the camera I wanted. 5 stars!

    Just a comment for your consideration, I did make 2 modifications.

    1.) Added minimum and maximum zoom distance variables and code accordingly. I didn't like being able to zoom in to 0 and zoom out with no limit on distance away from my character.

    2.) Removed the CursorLock code so that I could click buttons with the freeform component enabled. Clicking was turning on freeform and moving the cursor to the center of the screen so my buttons were never being clicked.

    .Thanks!
     
  15. Enzi

    Enzi

    Joined:
    Jan 28, 2013
    Posts:
    186
    Thank you very much! Also for the 5 star review. Much appreciated!

    1) Yeah, why is this not a setting in the first place? I'll add this in 1.0.5
    2) I see, the UIHandling is quite old to be honest and relies on colliders which it totally outdated in uGUI by now. I'll update this too, that way it should work out of the box when using uGUI.
     
  16. Enzi

    Enzi

    Joined:
    Jan 28, 2013
    Posts:
    186
    I've fixed the beta access for newer order numbers. (parsing to integer wasn't that clever)
    You can download the beta via order number or the invoice number. Both should work.
     
  17. alexbu92

    alexbu92

    Joined:
    Apr 7, 2019
    Posts:
    1
    Very interested in this asset. Is it possible to set up a camera like Rocket League's free form camera with this? (
    , which is basically a third person camera that follows the player but points in the direction the player is moving, not necessarily facing). How much is it off? Your collision sensitivity is definitely a must, but how much is missing to get to that kind of camera behavior? Thanks in advanced.
     
  18. Enzi

    Enzi

    Joined:
    Jan 28, 2013
    Posts:
    186
    Hey Alex!
    Thanks for your interest. TBH, if you want to recreate something very similar to the video you've shown me I'd not bother with camera collision and focus more on a script that is does a fine-tuned lerped Quaternion.LookRotation.

    If you do need collision.There is a script that follows any target and lerps to the forward vector of the target. In your case the forward of the car is not wanted so the solution is to make another gameobject (I call it "SlowFollowTarget") that is the target of the camera and its position is interpolated from the car.
    That way everything is decoupled and can be tuned individually.

    This SlowFollow script can be as simple as:
    Code (CSharp):
    1.  
    2. public class SlowFollow : MonoBehaviour
    3. {
    4.     public Transform target;
    5.  
    6.     public float speed = 1.0f;
    7. public float rotationSpeed = 1.0f;
    8.  
    9.     void Update()
    10.     {
    11.         transform.position = Vector3.Slerp(transform.position, target.transform.position, Time.deltaTime * speed);
    12. transform.rotation = Quaternion.Slerp(transform.rotation, target.transform.rotation, Time.deltaTime * rotationSpeed);            
    13.     }
    14. }
    In any case, you probably want to extend this to fit your game and car speed, have different thresholds for example.
     
  19. p_hergott

    p_hergott

    Joined:
    May 7, 2018
    Posts:
    179
    Does multi camera?