Search Unity

  1. Unity 2018.1 has arrived! Read about it here
    Dismiss Notice
  2. Scriptable Render Pipeline improvements, Texture Mipmap Streaming, and more! Check out what we have in store for you in the 2018.2 Beta.
    Dismiss Notice
  3. If you couldn't join the live stream, take a peek at what you missed.
    Dismiss Notice
  4. Improve your Unity skills with a certified instructor in a private, interactive classroom. Learn more.
    Dismiss Notice
  5. ARCore is out of developer preview! Read about it here.
    Dismiss Notice
  6. Magic Leap’s Lumin SDK Technical Preview for Unity lets you get started creating content for Magic Leap One™. Find more information on our blog!
    Dismiss Notice
  7. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice

AAA Quality Adventure Camera Released!

Discussion in 'Assets and Asset Store' started by Tryz, Dec 21, 2013.

  1. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    2,762
    Hi all!

    I just released the Action/Adventure Camera Rig. It's not just a 3rd person camera, but a complete AAA quality camera including a full Mecanim Animator.

    When creating a AAA quality game, having a “third-person camera” isn't good enough. In fact, when you dissect
    Tomb Raider’s camera, you’ll see that the camera seamlessly transitions between several different types of
    camera behaviors. It’s this attention to detail that we've created in the Adventure Camera Rig.

    It comes complete with a code walk through to help you understand every detail. Of course, you can ignore that and simply use it as is.

    Check it out here.
    https://www.assetstore.unity3d.com/#/content/13768



    Feedback is always welcome!

    Thanks,
    Tim
     
    Last edited: Nov 20, 2017
  2. agentsmith

    agentsmith

    Joined:
    May 1, 2010
    Posts:
    132
    Any video showing how the camera behaves when walking around walls or tight spaces. I assume it doesnt clip through walls, right?
     
  3. jman12

    jman12

    Joined:
    Feb 10, 2013
    Posts:
    103
    In the web demo it clipped through walls. If you made it so it wouldn't, I'd buy it
     
  4. sefou

    sefou

    Joined:
    Aug 30, 2011
    Posts:
    287
    Hi TRyz,
    in the Web demo , if the character is too close to wall , i have some camera problem:



     
    Last edited: Dec 21, 2013
  5. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    2,762
    Wow! I am so sorry. I thought I'd get an email if someone replied to the thread and I never did... I just assumed no one replied.

    I found the clipping issue and it has been fixed. The web player is updated too (although I had to clear my cache).

    I felt the safest and most generic solution was to stop the camera from moving if it got into a position that would clip the avatar.

    So if you're rotating the camera around the avatar and it detects the avatar clipping, the camera will stop. Behind the scenes, the rotation will continue and when you get to a good position the camera will catch back up.

    The update is waiting approval from Unity now.

    Thanks for calling this out and again I'm sorry for the huge delay.

    $UnityNoClip.png
     
  6. imtrobin

    imtrobin

    Joined:
    Nov 30, 2009
    Posts:
    1,537
    Camera cannot zoom in /out using mouse wheel?
     
  7. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    2,762
    Hey imtrobin,

    No, unfortunately this version can't. I modeled it off of Tomb Raider 2013 and they use the mouse wheel for weapon switching.

    They do have a 'button press' zoom, but it's not something I implemented. I'll put it on the wish list.
     
  8. im

    im

    Joined:
    Jan 17, 2013
    Posts:
    1,391
    please fix it so it dont get stuck on stuff and then snaps into other side when u move enough it feels very bad

    give option to flow through make the thing invisible or transparent or let it clip into it

    also have option for scrollwheel for zoom...

    i mean dont make it so this way or that. give lots of option so we can configure away... perhaps have different classes that implement the different ways if it cant be done by having some settings we can tweak...

    also please add jump, some more common movement animations (sprinnt), crouch, (prone would be nice)

    also have more camera options for other than adventure .like fps/tps, rpg... let pick left, right, center, overhead from behind like in rpg

    thanks in advance
     
    Last edited: Feb 9, 2014
  9. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    2,762
    Hi IM,

    For your first statement, I think you mean that when the character is next to a wall and the camera is put into a tight spot it stops moving and then jumps if you keep moving the controls.

    Per the description a couple posts above, I chose to stop the camera (to avoid the clipping) until the player moves it to a safe place. I'll have to think about a better solution.

    I know others (outside of this thread) preferred that I stop the camera vs. allowing the clipping. However, you may be right about having options that allows the user to choose.

    Thanks for the other items. I'll put them on the wish list.

    Tim
     
    Last edited: Feb 9, 2014
  10. bhads44

    bhads44

    Joined:
    Feb 19, 2013
    Posts:
    37
    Hello,

    I've got your demo scene in unity setup as per your quick-start guide. I've setup the key names accordingly, however am only achieving control over the camera, but there is no movement from the character. I'm using the keyboard, not a joystick. What am I doing wrong?
     
  11. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    2,762
    Hi Bhads,

    If you'll email me at tim@ootii.com, I can help you out.

    When you email, can you tell me what platform you're using? I'm also curious if you're getting any animations from the character at all. Does he turn or walk in place?

    I'll definitely help you out.

    Thanks,
    Tim
     
  12. 3

    3

    Joined:
    Sep 16, 2012
    Posts:
    387
    I read you were developing a new system. When will that come out?
     
  13. MoHoe

    MoHoe

    Joined:
    Nov 5, 2012
    Posts:
    567
    Are you John Mac?

    The guy that created this
     
    Last edited: Mar 1, 2014
  14. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    2,762
    Hey MoHoe,

    Nope, not John. I have seen the video before, but haven't been through them all.

    I'm not sure if he has physics based smoothing, supports multiple stances, or other features. Feel free to download what he has. :)
     
    Last edited: Feb 15, 2014
  15. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    2,762
    Hi 3,

    I'm working on a character controller that allows you to plug in motions. You can see the progress in videos I post here:
    http://www.youtube.com/watch?v=qUIOhaDP_Pc

    I'm not working on this full time so it's going slower than I hoped. No ETA to commit to yet. Sorry.
     
  16. MoHoe

    MoHoe

    Joined:
    Nov 5, 2012
    Posts:
    567
    Hey Tryz, I have downloaded it, it's good but not what I'm looking for :)

    Are you up for some paid work? it's to do with a mecanim controller.. it's quite simple but challenging.

    PM me if you want more info.

    regards
    Mohoe
     
  17. 3

    3

    Joined:
    Sep 16, 2012
    Posts:
    387
    I don't think it would be fair to have him to work exclusively for him, as he has previously said, he is working on a full character system for mecanim that will be available on the asset store soon.

    That being said, if you are willing to do work for individuals and aren't going to release the full system within a month or two, I will also pay you to develop a system for my team. But since there is such a high demand for a full character system controller, I think it would be most profitable and fair to just release an alpha version of the one you are currently making right now on the asset store.

    Just my idea, Best of luck though!
     
    Last edited: Feb 16, 2014
  18. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    2,762
    I took a couple of days because I wanted to have something to show before I posted again...

    I've created a new thread for the "Motion Controller":
    http://forum.unity3d.com/threads/229900-Motion-Controller

    I'd like to use this for bugs, requests, etc. As it is, you can find 4 new videos of what I'm working on.

    I'm hoping to submit it next week, but it may take another week for Unity to accept it (I'm not sure if the 'beta' tag will be an issue).

    Anyway, feel free to post over there (or email me) if you have any questions.

    Thanks for all the love! :)
     
  19. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    2,762
  20. dl_studios

    dl_studios

    Joined:
    Oct 14, 2012
    Posts:
    76
    Hi Tim,

    We're really loving this Adventure Camera in combination with the Motion Controller. It's a solid combo. We're glad to see that zoom is on the wish list. We're trying to decide whether to hack into the Adventure Cam and implement the zoom ourself or wait. When do you feel you'll be implementing the zoom?

    Thanks!
     
  21. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    2,762
    Hey DL,

    I'm glad they are working out for you. It's cool knowing that people are liking the tools.

    Zoom is on the list and it's something we need for our game. We've got ranged combat (think bows and spells), so it will be important. Unfortunately, melee combat and a couple of other things are our top priority.

    I hate telling you this, but I'm thinking it's at least two months away...maybe longer. :(

    If you do decided to tackle it, please don't hesitate to email me. I'll help anyway I can, even if it's just tossing ideas around.

    I wish I had better news,
    Tim
     
  22. PlayingKarrde

    PlayingKarrde

    Joined:
    Aug 19, 2013
    Posts:
    12
    Hey so I'm having some issues with the camera. For the most part it's working fine, but there are a couple of anomalies that I was wondering if you could have a look into.

    I already posted about the issue of the camera getting "stuck" when getting too close (I still think it's crazy to do it this way) but that issue seems to be bleeding into other areas too. I'm finding with terrain (not even specifically uneven terrain, really anything that isn't just straight up flat) the camera sometimes gets caught and the character will run away for a few seconds before the camera unsticks itself and catches up. I'm not sure what the camera is getting stuck on exactly but it happens enough to be extremely annoying.

    The other thing is when looking up and the camera pulls in close to the character causing another "stuck" position meaning you can't rotate it around at this point. Again, it's a product of this design decision to choose to stop the camera rather than deal with it elegantly.

    Overall it really is a great camera system and I like it a lot, but I do implore you to take a look at this problem and raise the priority on adding the option to have it cull the player if need be, or really just anything that isn't this. I know you have been modelling everything on Tomb Raider and can tell you for sure this is not something they do. Maybe take a look at their solution and go from there.

    If you need images or video from me to explain in more depth what is happening I'll be more than happy to provide.

    Thanks again.
     
  23. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    2,762
    Hey PlayingKarrde,

    There's two different issues going on. I understand they seem like the same thing, but they are different.

    I've had about 10 people report this 'rubber-banding' issue where the camera lags behind, catches up quickly, lags behind... In all cases, it turned out that there were setup issues. Basically, the collisions detection raycast of the camera was detecting a collision that shouldn't be there. Here's the top reasons:

    1. Avatar's layer wasn't set to User Layer 8. This caused the raycast to collide with the player.

    2. An additional collision volume (i.e. another capsule collider) was added to the avatar. This caused the raycast to collide with the collision volume.

    Please check if either of these are the case. If not, we can start looking for something more obscure.


    This is actually related to the setup issue above. When that's resolved, I'm confident this will be resolved as well.


    I totally understand you don't like the design decision and I'm confident that there's a better solution out there as well. Unfortunately, any simple solution I've tried or thought about has a downfall: either popping occurred, clipping occurred, or it would removed the avatar from the deferred rendering pipeline.

    I may get back to this, but as it isn't an actual bug it's not a priority right now.

    If you want to disable the feature, you can simply comment out Line 680 in the AdventureRig.cs. You could also customize it with a solution you prefer:

    // prevent the camera from moving

    rTargetPosition = transform.position;



    For now, the priority is to get the rubber-banding you're experiencing to stop. Please ensure the camera's raycast isn't inadvertently colliding with the player. Check out the two causes above. If fixing those doesn't solve the issue, the fastest way may be for me to get a version of your project that is showing the issue. I can peek inside and find the problem.
     
    Last edited: Apr 22, 2014
  24. PlayingKarrde

    PlayingKarrde

    Joined:
    Aug 19, 2013
    Posts:
    12
    Thanks for the reply. You're entirely correct that it's most likely a setup issue as I redid the character multiple times. I'll have a look and if this solves issues 1 and 2 then I'll be more than happy.

    Thanks for giving me the quick link to the line I need to disable. I'll take a look into it myself. I'll let you know what I come up with if you're interested.

    Thanks again for the great support!
     
  25. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    2,762
    NP. :)

    If that doesn't work, let me know and we can dig into it.

    Definitely interested in what you come up with. If you get stuck on anything, don't hesitate to email. I might be able to point you in the right direction.
     
  26. PlayingKarrde

    PlayingKarrde

    Joined:
    Aug 19, 2013
    Posts:
    12
    Yep you were 100% right. It was the avatar not being set to the correct layer (/facepalm). I'll dig into the other thing a bit later but you got me going forward now so thanks again for that!
     
  27. EmeralLotus

    EmeralLotus

    Joined:
    Aug 10, 2012
    Posts:
    1,298
    @ootii,

    Is there a way to access and change the various speeds of the animations within the example file? For example, how to make the character run slower or faster?

    Cheers.
     
  28. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    2,762
    Hey Rocki,

    I'm not exactly sure what you mean by "within the example file", but you can change the speed of the animations in the Animator.
    $Speed.png

    Remember that we're dealing with root-motion in the animation. That means speeding up the animation speeds up his movement as well.

    If you're asking something else, please let me know.

    Thanks,
    Tim
     
  29. EmeralLotus

    EmeralLotus

    Joined:
    Aug 10, 2012
    Posts:
    1,298
    Thanks,

    More specifically, how to set the speed for various mecanim states using code.
     
  30. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    2,762
    Unfortunately, with code...you can't.

    When using Mecanim, the best you can do is set the speed of the Animator itself. However, that changes the speed of every animation you play and on every layer:

    Animator.speed = value

    This may change in U5, but that's the best we've got right now.
     
  31. EmeralLotus

    EmeralLotus

    Joined:
    Aug 10, 2012
    Posts:
    1,298
    Is there any asset that can work around this limitation.
     
  32. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    7,923
    Hi,

    Nice camera package!

    I've come across one little issue. If the camera is moving and you pause the game (Time.timeScale=0) and then unpause it (Time.timeScale=1), AdvCameraRig hangs up with:
    Code (csharp):
    1.  
    2. transform.rotation assign attempt for 'AdvCameraRig' is not valid. Input rotation is { NaN, NaN, NaN, NaN }.
    3. UnityEngine.Transform:set_rotation(Quaternion)
    4. com.ootii.Cameras.AdventureRig:ApplyRotation() (at Assets/AdventureCamera/Scripts/ootii/Cameras/AdventureRig.cs:647)
    5. com.ootii.Cameras.AdventureRig:PostControllerLateUpdate() (at Assets/AdventureCamera/Scripts/ootii/Cameras/AdventureRig.cs:438)
    6. com.ootii.Cameras.AdventureRig:LateUpdate() (at Assets/AdventureCamera/Scripts/ootii/Cameras/AdventureRig.cs:422)
    7. transform.position assign attempt for 'AdvCameraRig' is not valid. Input position is { NaN, NaN, NaN }.
    8. UnityEngine.Transform:set_position(Vector3)
    9. com.ootii.Cameras.AdventureRig:ApplyMovement() (at Assets/AdventureCamera/Scripts/ootii/Cameras/AdventureRig.cs:603)
    10. com.ootii.Cameras.AdventureRig:PostControllerLateUpdate() (at Assets/AdventureCamera/Scripts/ootii/Cameras/AdventureRig.cs:437)
    11. com.ootii.Cameras.AdventureRig:LateUpdate() (at Assets/AdventureCamera/Scripts/ootii/Cameras/AdventureRig.cs:422)
    12.  
    I used the little script below to reproduce the issue. I just added it to the Sample scene, played, moved the mouse, and then hit Escape twice.

    Code (csharp):
    1.  
    2. using UnityEngine;
    3. using System.Collections;
    4.  
    5. public class TestPause : MonoBehaviour {
    6.  
    7.     private bool paused = false;
    8.  
    9.     void Update () {
    10.         if (Input.GetKeyDown(KeyCode.Escape)) {
    11.             paused = !paused;
    12.             Time.timeScale = paused ? 0 : 1;
    13.         }
    14.     }
    15. }
    16.  
     
  33. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    2,762
    Hey Tony,

    Thanks for the details! I'll get on it.
     
  34. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    7,923
    Wow, you're fast! Thanks!
     
  35. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    2,762
    Ok, I figured out what's going on. It's a bit of a chain of events...

    Issue:
    By setting Time.timeScale to 0, Time.deltaTime returns 0.

    Unfortunately, there's a couple of odd side effects. For example, the Mathf.SmoothDampAngle() function will result in an NaN value if the arguments are 0. That's what's happening in this case..

    Resolution:
    The simple fix is to not allow frame rate dependent functions like the camera's Update(), ApplyRotation(), and ApplyMovement() functions to run if Time.deltaTime is set to 0.

    I'll add this in an upcoming release, but for now you can put this at the top of the functions:
    if (Time.deltaTime == 0f) { return; }

    Side Note:
    So, any frame rate dependent functions are effected. If we're just multiplying, that's probably not a big deal (except in situation like above). If assets use division, that will be an issue.

    There is a MonoBehaviour.OnApplicationPause function assets could use to control pausing, but from what I'm reading most people are simply following the approach you're using.
     
  36. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    7,923
    Thanks! This is actually for a non-coding customer who's using Adventure Camera with the Dialogue System for Unity, so I'll ask him to keep an eye out for the fix in an upcoming release.
     
  37. mdotstrange

    mdotstrange

    Joined:
    Sep 23, 2013
    Posts:
    171
    Hey Tim- Is the adventure camera compatible with characters not using the "Humanoid" definition? I'm trying to use the adventure camera with my own player controller that uses a "generic" definition- it seems to work fine but at some point during playing it the controls get reversed depending on where the player is- its not giving me any errors- just the strange reversals- any ideas? thanks!
     
  38. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    2,762
    Hey MDotStrange,

    Just following up. Based on our emails, it looks like you found the issue with the input setup of your project.

    Please let me know if this isn't the case!

    Tim
     
  39. dreasgrech

    dreasgrech

    Joined:
    Feb 9, 2013
    Posts:
    193
    Does the camera also support non root-motion character locomotion? i.e. a velocity controller rigidbody character.
     
  40. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    2,762
    Hi Dreasgrech,

    Yes. In the project there is an 'IndAdventureRig.cs' file. This version allows you to specify any controller you want as it only needs a transform to follow. In the end, the camera doesn't really care about how the character is moved...it only follows the transform.

    Hope that helps,
    Tim
     
  41. reocwolf

    reocwolf

    Joined:
    Aug 1, 2013
    Posts:
    182
  42. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    2,762
    Hie Reocwolf,

    There shouldn't be any issues. You can use the camera rig with any character controller. Just use the IndAdventureRig.cs file that comes in the package.

    The camera just follows behind any transform (I call this the anchor), so it doesn't matter what the originating character controller is. Everything else will work as expected.

    If you do haven issues, I'm happy to help. :)

    Thanks,
    Tim
     
  43. mdotstrange

    mdotstrange

    Joined:
    Sep 23, 2013
    Posts:
    171
  44. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    2,762
    Hey MDotStrange,

    You can see I do something similar to that here (go to 00:25):


    This isn't so much a function of the camera as it is the controller.

    When I determined I was close enough to a target, I'd go into 'Combat Mode' (which seems to be the Z-targeting).

    When in this mode, my controller would force my avatar to always face the target with a simple "transform.rotate". Then, I'd convert my input coordinates to always be relative to how my avatar was facing.

    So, let's say the camera was looking up the -z axis and the goblin was on the left and my avatar was on the right. The Motion Controller's "Combat Forward" motion (something I newly created) would force the avatar to rotate to face the +x axis (to the goblin to the left). Then, if I pressed the 's' key to move down, the input is converted to be the 'a' key which is 'left' for the avatar. He's facing left, so down is to HIS left...

    To do this, I just multiplied the raw input data by the character's rotation:
    Vector3 lNewInput = transform.rotate * lRawInput;

    Then, I sent this "new input" in the Motion Controller's State object and it was sent to the Animator.

    In this way, the avatar would easily orbit around the target.

    The Adventure Camera really didn't have a part in this. In the video, you can see that the character rotates around the target and the camera is just pulled along by the controller. That's exactly what I wanted.

    Hope that helps.
     
  45. mdotstrange

    mdotstrange

    Joined:
    Sep 23, 2013
    Posts:
    171
    Thanks Tim- I'll give it a go with my controller.
     
  46. GXMark

    GXMark

    Joined:
    Oct 13, 2012
    Posts:
    384
    Issue 1.

    Purchased the camera system today with much interest for integration into my RPG game. I am wanting to move over from uFPS to this but have a problem regarding the camera clipping into the terrain. I'm suspecting its the camera collision with terrain logic that is the issue here?

    The uFPS camera never did this and was wondering if i'm missing a setup to stop this from happening. I've read the blog site here and have my player on layer 8.

    Issue 2.

    When running up and down a mountain i've noticed the player tends to hop down while it runs probably due to the gravity value. What i would like is to stick the character closer to the terrain down hills to stop this effect. Any ideas what to set for this?

    Issue 3.

    I've noticed that when running up hills the camera tends / or avatar tends to speed up which looks really un-natural. Any ideas how to fix this?
     
  47. GXMark

    GXMark

    Joined:
    Oct 13, 2012
    Posts:
    384
    Issue 1 Solved.

    The HandleCollision routine is defective for terrain clipping. Author ~ suggests replacing your routine with the following.

    Code (CSharp):
    1.      
    2.         public void Start()
    3.         {
    4.             // Initialize the camera distances
    5.             mTransitionDistance = _Distance;
    6.             mSideTransitionDistance = 0f;
    7.  
    8.             // Force the orbit function as it will get everything in synch
    9.             // from the beginning.
    10.             mViewVelocityX = 0.0001f;
    11.  
    12.             _CameraRigOffset = Controller.GetComponent<AdventureController>().CameraRigOffset;
    13.         }
    14.  
    15.         private bool HandleCollision(Vector3 rAnchorPosition, ref Vector3 rCameraPosition)
    16.         {
    17.             // start position is the center of the character controller and height of the camera PositionOffset. this will detect
    18.             // objects between the camera and controller even if the camera PositionOffset is far from the controller
    19.  
    20.             // get the collision start position
    21.             Vector3 cameraCollisionStartPos = Controller.transform.TransformPoint(0, _CameraRigOffset.y, 0);
    22.        
    23.             // end position is the current camera position and move it back the distance of the colliders controller radius in order to reduce
    24.             // camera clipping issues very close to walls.  Keep the near clipping plane distance near 0.04 for good results.
    25.             Vector3 cameraCollisionEndPos = rCameraPosition + (rCameraPosition - cameraCollisionStartPos).normalized * Controller.ColliderRadius;
    26.  
    27.             // Raycast against only terrain and scene objects
    28.             int  layerMask = 1<<Layer.TERRAIN | 1<<Layer.SCENE;
    29.        
    30.             // Do a linecast and mask out the player
    31.             //Debug.DrawLine(cameraCollisionStartPos,cameraCollisionEndPos,Color.red);
    32.             if (Physics.Linecast(cameraCollisionStartPos, cameraCollisionEndPos, out sCollisionInfo, layerMask))
    33.             {
    34.                 rCameraPosition = sCollisionInfo.point - (sCollisionInfo.point - cameraCollisionStartPos).normalized * Controller.ColliderRadius;
    35.                 return true;
    36.             }
    37.  
    38.             return false;
    39.         }
    40.  
    41.  
     
    Last edited: Oct 19, 2014
  48. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    2,762
    Hi GXMark,

    For #1: Thank you for the solution, but based on the code, it looks like you're using an older version of the camera. The newer versions uses a function called 'SafeRaycastAll' and doesn't require a 'Player Layer' anymore.

    I did raise the terrain to ensure the camera would move if the terrain was blocking the character and it did. Could you test with the latest version and make sure it's working for you as well?


    For #2: I think what you may need to do is a second grounding adjustment after the character controller's "Move" function is called.

    The AdventureController that comes with this asset is certainly usable as a base for your character controller, but it's focus was to really show off this camera asset. What I learned when creating my follow-on character controllers was that there really needed to be a secondary test that actually pulled the character to the ground.

    This is especially true if you find the forward speed of your character "out paces" the slope the character is on. What I mean is that gravity isn't strong enough to pull the character down to the full distance of the slope in a single frame.

    Here's what I do in the Motion Controller:
    Code (CSharp):
    1.  
    2.                 // If we're grounded, we want to force the avatar down onto the
    3.                 // surface. We do this because running downhill can cause a
    4.                 // large gap between the avatar and the surface
    5.                 if (mState.IsGrounded && mState.GroundDistance > 0.01f && lIsGravityEnabled)
    6.                 {
    7.                     float lGroundDistance = GroundCast(ref sGroundCollisionInfo);
    8.                     Vector3 lGroundDistanceAdjust = new Vector3(0, -lGroundDistance, 0);
    9.  
    10.                     mCharController.Move(lGroundDistanceAdjust);
    11.                     mState.GroundDistance = 0f;
    12.                 }
    13.  
    After I process the initial movement and determine if I should be grounded, I do this final test in the Update() function. If I'm further from the ground then I should be, I actually call Move() again with this adjustment.

    To be honest, I never brought this over to the Adventure Controller because I never really thought people cared about the controller vs. the camera. Anyway, if you think you should be grounded, just do another ray cast to the ground and move again.

    #3 - I'm not seeing this in the tests that I'm doing, but maybe it's because I'm not mirroring your scenario. Can you send me a sample scene so I can see it happen? Please send to tim@ootii.com

    Thanks!
     
    Last edited: Oct 19, 2014
  49. GXMark

    GXMark

    Joined:
    Oct 13, 2012
    Posts:
    384
    Thanks for your reply.

    I found that by just simply adding downward movement will be enough to maintain the avatar on very steep mountains.

    Simply added to to Adventure Controller at bottom of update.

    Vector3 groundDistanceAdjust = new Vector3(0, -0.15f, 0);
    mCharController.Move(groundDistanceAdjust);
     
    Tryz likes this.
  50. GXMark

    GXMark

    Joined:
    Oct 13, 2012
    Posts:
    384
    For #1: Thank you for the solution, but based on the code, it looks like you're using an older version of the camera. The newer versions uses a function called 'SafeRaycastAll' and doesn't require a 'Player Layer' anymore.


    No it is the version 1.10 code as i downloaded it yesterday i replaced your function with. This code is the replacement which stops terrain clipping. It is entirely possible that the line cast could be replaced with SafeRaycastAll method.

    Anyways i'm sure the readers can try this routine if they get the issues i was finding. :)