Search Unity

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:
    962
    @Zan_Kievit
    I have a new version 1.0.6.5 for you to test out here
    This should see improvements in the overlapping colliders problem.

    I still have some work to do with the thickness check. So while testing, please consider turning it off first.
     
    Last edited: Oct 12, 2020
  2. Enzi

    Enzi

    Joined:
    Jan 28, 2013
    Posts:
    962
    1.0.7 can be tested now on my beta page

    If i don't get any error reports on this one I'll push it to live in the next few days.
     
  3. Zan_Kievit

    Zan_Kievit

    Joined:
    Mar 24, 2018
    Posts:
    14
    Awesome progress! I haven't been able to reproduce the jumping nor the collision ignoring at the bottom of the character!

    The only bug that I've found that still exists is that the camera ignores collisions on edges between colliders. (I've also found this to be the case on transitions from box colliders to mesh colliders. Specifically from the big box to the floor plane)
     
  4. Enzi

    Enzi

    Joined:
    Jan 28, 2013
    Posts:
    962
    @Zan_Kievit Great!
    Odd to hear about the collider transition bug though. This should be fixed, at least I can't reproduce it any more.

    Can you reproduce one of the videos you've sent me or does this apply to a special case? Does it also happen with thickness check turned off?
     
  5. Zan_Kievit

    Zan_Kievit

    Joined:
    Mar 24, 2018
    Posts:
    14
    I'm mentioning the new bug I showed in the screenshot. The bug seems to be fixed between box colliders, but not between mesh and box colliders. It doesn't happen with thickness turned off. (And remember to turn off smart pivot to get the bug.)
     
  6. Enzi

    Enzi

    Joined:
    Jan 28, 2013
    Posts:
    962
    Hm, I changed the box to a mesh collider, convex on/off and couldn't get what you were mentioning.

    Can you send me a video with details how you are able to do that or post it here?

    Thanks in advance!
     
  7. Zan_Kievit

    Zan_Kievit

    Joined:
    Mar 24, 2018
    Posts:
    14
     
  8. Enzi

    Enzi

    Joined:
    Jan 28, 2013
    Posts:
    962
    Thank you very much, I can reproduce now.

    I've a bug to fix in the thickness check routine. :) I will keep you posted.
     
    Zan_Kievit likes this.
  9. Enzi

    Enzi

    Joined:
    Jan 28, 2013
    Posts:
    962
    @Zan_Kievit
    I've upped 1.0.7.1 here with a fix to this case.
    I'm filtering out floors so the thickness checks work with smart pivoting but when Smart Pivot is turned off this results in a false positive in thickness because only the box is calculated and not the floor.
    Anyway, this filter only happens when the camera is smart pivoting now so this bug should be fixed even in edge cases.

    If you happen to find anything else please let me know. Your support has been very helpful for me to efficiently find these cases and fix them, so big thanks!
     
    Zan_Kievit and Broudy001 like this.
  10. Broudy001

    Broudy001

    Joined:
    Feb 12, 2020
    Posts:
    72
    Hi,

    I'm trying to make something similar to Breath of the Wild, not in scope but in the way it plays. Something I thought might be handy would be an extra option for the disable follow which allows the character to change direction and run towards the camera. I've added a bit to the disablefollow script

    public bool activateTowardsCamera = true;

    After the if (freeform.x != 0...
    float angle = Vector3.Angle(cameraController.target.forward, cameraController.transform.forward);
    if (angle > 90f)
    {
    follow.follow = false;
    followDisabled = true;
    }

    then after the if (activateMouseCheck && ...

    if (activateCheckTowardsCamera & angle < 90)
    {
    follow.follow = true;
    followDisabled = false;
    }

    it seems to work fairly well for me, but I'm sure it could be improved.
     
  11. Zan_Kievit

    Zan_Kievit

    Joined:
    Mar 24, 2018
    Posts:
    14
    I haven't been able to reproduce any problems, nor have I found anything new, if I do in the future you'll hear from me!

    No problem, it helps me and my projects out as well, and being able to put my perfectionist bug testing self to good use is always a nice feeling lol
     
    Enzi likes this.
  12. Enzi

    Enzi

    Joined:
    Jan 28, 2013
    Posts:
    962
    1.0.7.2 has been submitted to the asset store and should be available soon.
    As usual, you can also access a new version here directly.

    This update provides a stepping stone for other camera models that were initially not planned for the asset. A limitation is that camera movement is bound to the target movement. This is not a problem for previously supported genres but for genres that don't directly tie player movement to the camera like Mario64, Zelda or FFXII as an example, this behaviour was not supported.

    In the coming updates I'll add these new camera types and instead of making a Version2 and as a way to thank all the people who have supported this asset in the past, this will be added freely. When the update (1.8) is released the final price will be 35$.
     
    Broudy001 and Zan_Kievit like this.
  13. chaoticmass

    chaoticmass

    Joined:
    Nov 25, 2018
    Posts:
    7
    How do I set the target at runtime?
     
  14. Enzi

    Enzi

    Joined:
    Jan 28, 2013
    Posts:
    962
    You can use the method InitFromTarget(Transform newTarget) in CameraController.

    Code (CSharp):
    1. var cc = Camera.main.GetComponent<CameraController>();
    2. cc.InitFromTarget(target);
     
  15. Pixelith

    Pixelith

    Joined:
    Jun 24, 2014
    Posts:
    577
    I just have a quick question regarding Free Form.

    When no input is being used, is there a feature to have the camera automatically smooth follow behind the character?

    I have an idea on how to do this but I don't want to go into the script and edit if its already a feature
     
  16. Enzi

    Enzi

    Joined:
    Jan 28, 2013
    Posts:
    962
    Yes, take a look at the car follow demo scene.
    If you put the Follow component and DisableFollow on the gameobject with the CameraController, it's configurable to smoothly follow when no input is made after a certain amount of time.
    Is this what you're looking for?
     
    Pixelith likes this.
  17. Pixelith

    Pixelith

    Joined:
    Jun 24, 2014
    Posts:
    577
    That sounds about right! I'll have to try it all out later
     
  18. alsomitra

    alsomitra

    Joined:
    Aug 31, 2017
    Posts:
    33
    Hey,

    It's an awesome camera controller.

    But.I tested it and I get the following error

    Assets/3rdPersonCamera/Scripts/InputSampling/CameraInputSampling_FreeForm.cs(238,17): error CS0103: The name 'lockMouseCursor' does not exist in the current context

    Thank you!
     
  19. Enzi

    Enzi

    Joined:
    Jan 28, 2013
    Posts:
    962
    Thank you! :)

    I renamed the variable and it wasn't renamed in the #else block.
    Can you rename lockMouseCursor to lockAndHideMouseCursor?

    Sorry for that, it'll be fixed in the next update.
     
  20. vincentchan28

    vincentchan28

    Joined:
    Dec 15, 2020
    Posts:
    1
    May I know if this plugin supports mobile control in android and iphone?
     
  21. Enzi

    Enzi

    Joined:
    Jan 28, 2013
    Posts:
    962
    Hey!
    Sorry for the late reply. There are no virtual controls out-of-the-box but with some scripting or a plugin it can be integrated. Any plugin that can map the mouse movement should be sufficient.
     
  22. Kadarn88

    Kadarn88

    Joined:
    Jun 28, 2020
    Posts:
    5
    hello @Enzi please how can i roll back to version 1.0.6.3 ? i updated to 1.0.7.2 for a mistake but all my pointing system was built based on the "Ignore X rotation" flag that was removed in this latest version.
     
  23. Enzi

    Enzi

    Joined:
    Jan 28, 2013
    Posts:
    962
    Hello!

    Send me an email here. As I have all the previous versions saved, I can send you 1.0.6.3. I don't know any way to downgrade in the asset store.
     
  24. Kadarn88

    Kadarn88

    Joined:
    Jun 28, 2020
    Posts:
    5
    @Enzi thank you for the quick reply, however i found a backup in my PC luckily, but it's good to know you keep old versions as well :)
     
  25. kidmethuselah

    kidmethuselah

    Joined:
    Jan 14, 2021
    Posts:
    18
    Is there a way to "turn off" the bit that makes the third person cam "look up" when it hits the floor? I would prefer it to just stop when it hits the floor.

    EDIT: Nevermind, found it. To anyone reading this with the same issue: change your "Y angle limit min" on the "free form" script to 90 degrees :)
     
    Last edited: Mar 28, 2021
  26. MikielSG

    MikielSG

    Joined:
    Dec 26, 2016
    Posts:
    47
    I am looking for a good script for 3d gameplay for space, with no terrain, would you recommend this asset for this?
     
  27. iguanou

    iguanou

    Joined:
    Jul 3, 2017
    Posts:
    2
    Hello ! Anyone knows if this camera controller works well with the new unity system ? I don't think I'll be able to make all the changes on my own if it's not compatible.
     
  28. Pixelith

    Pixelith

    Joined:
    Jun 24, 2014
    Posts:
    577
    It has the capacity to support the new input system if that's what you meant. You have to write the input script yourself, but it's fully supported as that's how I'm using it.
     
  29. Enzi

    Enzi

    Joined:
    Jan 28, 2013
    Posts:
    962
    Hello!

    The asset has 3 input sampling scripts for FreeForm, LockOn and Shoulder which should be easily adaptable with coding experience.
    I can send you one of these files via email if you're interested in evaluating.
     
  30. madruytb

    madruytb

    Joined:
    May 10, 2018
    Posts:
    26
    Hey Enzi! Great job with your asset, it really saved me alot of time, the customization and tweaking options are so sweet!
    But can you help me with one thing? In my project, I have a system where you can swap the time of the day with the pause menu,loading, basically a: Different scene with same level/scenario but with different lighting, so because of that, the player character loads in the same position and rotation as he were in the previous scene. But I can't see to find a way to also load the stored camera rotation, changing it with:
    Code (CSharp):
    1. (Pseudocode)
    2. mainCameraTransform.rotation = storedCameraRotation;
    Doesn't work, so how can I load the stored camera rotation with your asset?
     
  31. Enzi

    Enzi

    Joined:
    Jan 28, 2013
    Posts:
    962
    Hello!

    Thanks a lot!
    Please use the InitFromTarget(Transform newTarget) method in CameraController. Alternatively you can set the public Quaternion cameraRotation (which is also in CameraController) directly when positions haven't changed.
     
  32. upperclass12345

    upperclass12345

    Joined:
    Jun 28, 2021
    Posts:
    1
    I love this update! I've recently started learning gaming programming and it's really hard for me. The good thing is that there is so much information available and everything is possible if I am willing to put in the work. My dream is to create a game like WoW and I am constantly looking at https://wowcarry.com/wow/farm-leveling/gearing in order to discover more things about this game. A friend of mine is helping me, so I am not doing all of the work, but it's still something that is not easy.
     
    Last edited: Jun 28, 2021
  33. Lunarthewolf

    Lunarthewolf

    Joined:
    Feb 10, 2019
    Posts:
    10
    Hey, this asset has been a huge help for me. I'm currently using free form with lock on. So far as I can tell, lock on can only be toggled by pressing the specified button. However, I would prefer to have lock on be released when I release the button, like in the WebGL demo. Is there a way to do this with the included scripts? Or will I have to write my own input script?
     
  34. Enzi

    Enzi

    Joined:
    Jan 28, 2013
    Posts:
    962
    Hey, thanks! Nice to hear! :)
    Yeah, I don't have a setting for that.

    Here are the code change to get what you need.
    Important is that you change the disable time in the Lock On Target component to 0! It'll interfere when using CameraMode Always.

    From:
    CameraInputSampling_LockOn.cs Line 85-86
    Code (CSharp):
    1. if (Input.GetMouseButtonDown(mouseLockOnInput[i]))
    2.     followingTarget = !followingTarget;
    To:
    Code (CSharp):
    1. if (Input.GetMouseButton(mouseLockOnInput[i]))
    2.     followingTarget = true;
    3. else
    4.     followingTarget = false;
    Same goes for the other inputs, keyboard and gamepad:
    Code (CSharp):
    1. if (Input.GetKey(keyboardLockOnInput[i]))
    2.  
    Code (CSharp):
    1. if (Input.GetButton(buttonLockOnInput[i]))
     
    Lunarthewolf likes this.
  35. madruytb

    madruytb

    Joined:
    May 10, 2018
    Posts:
    26
    Hey Enzi,the asset works perfectly except I noticed that the camera goes a bit wild when going through a normal sized door (attached video shows the issue.)

    Do you have any solution or suggestion on how to make the camera a bit smoother in situations like this?
    Thanks in advance.

     
  36. Enzi

    Enzi

    Joined:
    Jan 28, 2013
    Posts:
    962
    Hello, thank you for reporting! I'll take a look at the issue and get back to you with a solution.

    In case it's model related, are you able to send me the door model for testing?
     
  37. madruytb

    madruytb

    Joined:
    May 10, 2018
    Posts:
    26
    Sure thing!
     
    Last edited: Oct 19, 2021
  38. Enzi

    Enzi

    Joined:
    Jan 28, 2013
    Posts:
    962
    Cool, thanks! Helps me a lot for figuring out such errors!
    I have the model saved now so feel free to remove the link.
     
  39. Lunarthewolf

    Lunarthewolf

    Joined:
    Feb 10, 2019
    Posts:
    10
    It looks like the Tilt Vector field of the Lock On Target script doesn't actually do anything. I tried modifying it, didn't seem to change the functionality. The only references I can find are to the Tilt Vector field in the Follow component, which does work as expected. Am I missing something?
     
  40. madruytb

    madruytb

    Joined:
    May 10, 2018
    Posts:
    26
    Also, I just noticed that when input mode is on, for some reason UI can block the camera movement, as you can see in this video:


    How can I prevent UI from interfering in the mouse input?
     
  41. Enzi

    Enzi

    Joined:
    Jan 28, 2013
    Posts:
    962
    Yes, that's intended behaviour. When an UI element is hovered the camera is not updating inputs so it doesn't accidentality start orbiting when you click something in the interface, inventory for example.
    The intended way to prevent that is to lock the mouse cursor. I think you'd want that, right? There's an option in InputSampling_FreeForm for it.
    In case you don't, you'd have to remove or modify the line:
    Code (CSharp):
    1. interfaceHovered = EventSystem.current.IsPointerOverGameObject();
    in CameraInputSamping_FreeForm.cs to fit your needs. Further check for layer or something.

    About the door problem, I can't reproduce it with the model you sent me. Can you reproduce the error in the demo scene with this model? And can you take a screenshot of all the settings you're using? You can post it here or send it to my support email address. Thanks!

    Sorry, no you are not. The tilt vector is indeed missing in the LookRotation! I forgot to add when I did the big pivotRotation rewrite.
    Fortunately it's an easy fix:
    LockOnTarget.cs
    Line 224, replace with:
    Code (CSharp):
    1. cameraController.cameraRotation = Quaternion.Slerp(cameraController.cameraRotation, Quaternion.LookRotation(dirToTarget [B]+ tiltVector[/B], Vector3.up), Time.deltaTime * rotationSpeed);
    Line 233, replace with:
    Code (CSharp):
    1. Quaternion toRotation = Quaternion.Inverse(cameraController.cameraRotation) * Quaternion.LookRotation(dirToTarget [B]+ tiltVector[/B], Vector3.up);
     
  42. ludo2vie

    ludo2vie

    Joined:
    Jun 11, 2021
    Posts:
    3
    Hello all,
    My camera working only when I disable my "EventSystem"
    ... It's annoying because my buttons don't work anymore...
    Did I forget something ?
     
  43. Enzi

    Enzi

    Joined:
    Jan 28, 2013
    Posts:
    962
    With EventSystem, do you mean the default Unity UI event system?
    Are you using the new input system?
     
  44. ludo2vie

    ludo2vie

    Joined:
    Jun 11, 2021
    Posts:
    3
    Sorry, but I'm new to Unity.
    The eventSystem allows me to activate buttons through Unity.UI
    This is the one that causes me problems with the camera.



     
  45. Enzi

    Enzi

    Joined:
    Jan 28, 2013
    Posts:
    962
    Can you eleborate on the steps/setup that are involved in breaking the camera? Screenshots of scene for example.

    The provided demo scenes all use UnityUI and the Event System too. Can you confirm they are working for you?
    Do you by chance have 2 Event Systems in the scene?
     
  46. ludo2vie

    ludo2vie

    Joined:
    Jun 11, 2021
    Posts:
    3
    I solved my problem, I had a transparent image that was in my button canvas.
    Thanks for your patience ;)
     
    Enzi likes this.
  47. madruytb

    madruytb

    Joined:
    May 10, 2018
    Posts:
    26

    Hey Enzi thank you for explaining, what happened to the door was that I added a small trigger collider close to it and the camera was getting blocked, but I didn't think that trigger colliders would affect the camera, is there any way to prevent triggers from colliding with the camera?
     
  48. Enzi

    Enzi

    Joined:
    Jan 28, 2013
    Posts:
    962
    Hey! Thanks for the explanation. Triggers are excluded and should not affect the camera collision. I'll look into it where this might not be the case and get back to you.
     
  49. Dragonlord_DRM

    Dragonlord_DRM

    Joined:
    Jan 26, 2017
    Posts:
    7
    Hi Enzi,

    I recently purchased your 3rd Person Camera Asset and am testing it out but receive the following error in the console when playing the scene.

    Controller Error - Right axis not set in InputManager. Controller is disabled!
    UnityEngine.Debug:LogWarning (object)
    ThirdPersonCamera.CameraInputSampling_FreeForm:Start () (at Assets/3rdPersonCamera/Scripts/InputSampling/CameraInputSampling_FreeForm.cs:115)

    Please advise.

    Thanks.
     
  50. Enzi

    Enzi

    Joined:
    Jan 28, 2013
    Posts:
    962
    Hello!

    It's just a warning when the axis for a controller is not set in the InputManager.
    There's a folder "ProjectSettings" in the asset with a file called "InputManager.asset". You can copy this to your ProjectSettings folder and gives you a default setup for the controller. Doing so would overwrite the inputs you have already defined, so be aware.

    Of course you can also set them manually. These are the default ones with cross-platform support for Windows/Mac/Linux:
    upload_2022-3-8_15-22-26.png

    upload_2022-3-8_15-22-43.png
     
    Dave_3Dln likes this.