Search Unity

Camera Controller Release

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

  1. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    Cool. I'm glad that was easy. :)

    I think I understand, but it sounds a bit odd... (if I do).

    The follow motor will drag the camera behind the character as if it's on a rope. So, if the character walks to the left, the camera will always look at the character and at some point get pulled behind the him. That's the "auto rotation".

    You're saying you want the camera to get drug behind the player towards the left, but if you're holding the right stick to the right you want the camera to orbit to the right (and not looking at the character).

    Unless you force the camera view using CameraController.SetTargetForward(), the motor requires the camera to look at the character.

    Do you have a video or something that explains what you're trying to do? Maybe you really want a different motor than the 3rd Person Follow (when moving).
     
  2. Vanidash-Studios

    Vanidash-Studios

    Joined:
    Mar 9, 2016
    Posts:
    71
    Hi, What setting do i have to change in order to rotate the camera in the 3rd person motor as i move the mouse instead of having to hold righ/left click and move the mouse
     
  3. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    On the Input Source is a "View Activator" property that is a drop-down. You can change that to "None" and now you don't have to hold any buttons.

    I put it on the Input Source because other things (like the character controller and GUI) need to know if the mouse is moving to activate the view... or just moving.
     
  4. Vanidash-Studios

    Vanidash-Studios

    Joined:
    Mar 9, 2016
    Posts:
    71
    Got it, Thanks!
     
    Tryz likes this.
  5. wightwhale

    wightwhale

    Joined:
    Jul 28, 2011
    Posts:
    397
    Here's a video of the issue, you can see that it gets stuck so to speak when the character is moving faster and you're unable to rotate the camera past the midway point.



    Camera settings
     
  6. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    What I was trying to explain earlier is that you really can't do what you're asking with the 3rd Person Follow motor out-of-the-box. You can with the 3rd Person Fixed motor, but not the follow motor.

    The follow motor is built to be drug behind the character. So, each time you move, the camera will "drag" or orbit more and more behind the character.


    As you're trying to force the orbit around, you're fighting against the drag. Even at the super high orbit speed that you have (5000 degrees per second), it will be very touchy as it fights the drag. You can see that here:



    To do what you want, you'd have to modify the OrbitFollowMotor.cs to disable the drag while you're trying to orbit. Changing line 116 from this:
    Code (CSharp):
    1. else if (mTargetForward.sqrMagnitude > 0f)
    to this:
    Code (CSharp):
    1. else if (mTargetForward.sqrMagnitude > 0f || mFrameEuler.x != 0f)
    may get you close. However, you'd still have to keep the view rotation stable.
     
    hopeful likes this.
  7. wightwhale

    wightwhale

    Joined:
    Jul 28, 2011
    Posts:
    397
    This helps quite a bit, but I'm curious to know what you mean when you say I'd have to keep the view rotation stable.
     
  8. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    I just mean that as your character is moving forward you'll be holding the view where you want as best you can. As soon as you release the view (I'm assuming the right Xbox controller stick), the camera will get pulled back behind the character.
     
  9. wightwhale

    wightwhale

    Joined:
    Jul 28, 2011
    Posts:
    397
    Ah ok, that's actually desirable in my case. Thanks for the assistance again :)
     
    Tryz likes this.
  10. OreoSplitter

    OreoSplitter

    Joined:
    Oct 21, 2017
    Posts:
    33
    I am having an issues where the camera collision works as I am backing into a wall but when I get close enough it jumps to the other side of the wall. My player is 2 meters. Camera is first person, anchor player, offset Y 5.5 and Z -7, to look like 3rd person view. As I back up to a wall the camera slides down it half way (still above players height) then it "recovers" behind the wall blocking my view. Is there a way to never let the camera go through a wall?
     
    Last edited: Dec 8, 2017
  11. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    Given your setup, it's actually not going through a wall.

    This may help explain...


    The camera really doesn't care about the "character". It only cares about the anchor + offset.

    In the case of a third person motor, the anchor + offset is the thing we're focused on and there's a distance between the camera and the "focus". So, a wall can come between that and the camera will compensate.

    In the case of a first person motor, the anchor + offset is the position of the camera. There's nothing coming between the camera and the anchor + offset.

    This works for first person because typically the camera is in the head and the character won't allow the head to go into a wall... usually. Your setup is unique as you are making a first person camera motor simulate a third person camera motor.

    Can you explain more about why you set it up this way? Maybe I can help.
     
  12. OreoSplitter

    OreoSplitter

    Joined:
    Oct 21, 2017
    Posts:
    33
    Finally got it though I'm sure I tried this combo before. Basically using using your basic controller I wanted third person where q and e would rotate with a third party cam always behind player with player as anchor. Fixed third party and rotate with anchor works.

    Have you thought about making a player controller asset that works with this camera asset for common setups for various types of games? Like with my above setup if I wanted left mouse to also look around, left plus right would cause player to rotate and move forward. Let go of left mouse camera goes back to looking forward. Or an isometric game, character movement is point and click and the camera rotates the scene based on direction of character.

    Maybe there is already an asset out there but it seems like you have everything but character setups.
     
  13. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    I'm not sure if you've seen my Motion Controller, but it does this.

    I can't say that everything works exactly the way you describe, but depending on the motions you choose it's close.

    I mimic games like World of Warcraft, The Division, and Assassin's Creed. With the Motion Controller you can also create new motions so that you can get exactly what you want.
     
  14. Jick87

    Jick87

    Joined:
    Oct 21, 2015
    Posts:
    124
    @Tryz Hey, been a while since I posted here. :)

    I was having a little issue and figured I'd pop in real quick and ask about it...

    I'm noticing that when my scene starts, if my player is in a cramped area (like inside a little box), the camera ends up outside the box. I checked the properties and it seems what is happening is the anchor offset is being set to a value other than what I set it to in that case. And it never fixes itself. So I run around with a weird offset.

    This only seems to be an issue when the camera first initializes. Like, if I start out in an open area and then run into a cramped area, things are fine. It only seems to be an issue if my player is spawning inside a cramped area. I'm guessing there is some code somewhere on Start() or similar that messes with the anchor offset if the camera is colliding when it first spawns?

    Is there some way to fix this?

    Thanks!
     
    hopeful likes this.
  15. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    Can you send me a small project as this probably depends on the motor and settings you're using.

    I tried a simple example, but it worked how I'd expect. This first image is before I hit the play button. You can see the small box with the camera outside of it.



    This is what it looks like once I hit the play button.


    You can see the camera went inside the box like I'd expect.

    But, it could depend on your settings. If you can email tim@ootii.com a sample project that would help. :)

    Please include your Unity Order ID. This helps me track who I give support to. Thanks!
     
  16. Arkade

    Arkade

    Joined:
    Oct 11, 2012
    Posts:
    655
    Hi, @jessejarvis / @Tryz
    Slightly necro'ing this old thread about mobile control of Camera Controller...
    Any chance this code (or similar) was made public, please? (I'm just trying to port a jam game to mobile and ran into the same camera angle jumping around problem that Jesse originally had.)
    Thanks
     
  17. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    Sorry, it's not something I have. :(
     
  18. boysenberry

    boysenberry

    Joined:
    Jul 28, 2014
    Posts:
    365
    Hi There,

    I am integrating your wonderful Motion Controller and Camera Controller in with MapMagic and am having difficulty during the spawning process with keeping the player from falling before the terrain is created. The author provided a script that will turn off rigidbody like thus:
    rb.isKinematic = true; //disabling rigidbody
    rb.detectCollisions = false;

    The idea is to prevent the character from falling until the terrain is done being created. The terrain gets created based off of the camera positioning, so as the camera gets closer to the terrain it gets generated. That would great when the character is placed on an existing terrain, but when the terrain isn't already created there is a delay between it creation and when the terrain is ready. For that duration I need to keep the character in place.

    Do you have any suggestion on how I can make this happen?

    Thank you,
    Boysenberry Payne
     
  19. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    I see what you're saying.

    On the Actor Controller, you can uncheck "Is Gravity Enabled" until the terrain exists. It's under the "Gravity & Grounding" section.

    Another thing that will happen is that the character goes into a falling animation (since there's no ground). You've disabled gravity and he won't actually go down, but he will animate as if he's falling. So, the other thing you'll want to do is disable (uncheck) the Fall motion until your terrain exists.

    I just tried it and it worked. :)
     
    boysenberry likes this.
  20. Jick87

    Jick87

    Joined:
    Oct 21, 2015
    Posts:
    124
    Sorry for the delay, been busy...

    Anyway, I think I resolved my issue with this by changing the way I do things. I'll be sure to post back if I have any further issues with this.

    Thanks as always for the great support!
     
    Tryz likes this.
  21. boysenberry

    boysenberry

    Joined:
    Jul 28, 2014
    Posts:
    365
    Your advice worked perfectly.

    Here is what I used (I will share it on the MapMagic forum page as well):

    Code (csharp):
    1.  
    2. using UnityEngine;
    3. using com.ootii.Actors;
    4. using com.ootii.Actors.AnimationControllers;
    5.  
    6. namespace EternalLife
    7. {
    8.     public class FallEnabler : MonoBehaviour
    9.     {
    10.         protected MotionController mMotionController = null;
    11.         protected ActorController mActorController = null;
    12.         protected Rigidbody mRigidbody = null;
    13.  
    14.         public void OnEnable()
    15.         {
    16.             MapMagic.MapMagic.OnApplyCompleted -= EnableFall;
    17.             MapMagic.MapMagic.OnApplyCompleted += EnableFall;
    18.  
    19.             mRigidbody = GetComponent<Rigidbody>();
    20.             mActorController = gameObject.GetComponent<ActorController>();
    21.             mMotionController = gameObject.GetComponent<MotionController>();
    22.             MotionControllerMotion lMotion = mMotionController.GetMotion<Fall>(0);
    23.             // will no longer fall
    24.             mActorController.IsGravityEnabled = false;
    25.             lMotion.IsEnabled = false;
    26.             //disabling rigidbody
    27.             mRigidbody.useGravity = false;
    28.             mRigidbody.isKinematic = true;
    29.             mRigidbody.detectCollisions = false;
    30.         }
    31.  
    32.         public void OnDisable()
    33.         {
    34.             MapMagic.MapMagic.OnApplyCompleted -= EnableFall;
    35.             mRigidbody = null;
    36.             mActorController = null;
    37.             mMotionController = null;
    38.         }
    39.  
    40.         public void EnableFall(Terrain terrain) //checks if applied terrain contains object, and enables it's rigidbody if it does
    41.         {
    42.             Rect terrainRect = new Rect(terrain.transform.position.x, terrain.transform.position.z, terrain.terrainData.size.x, terrain.terrainData.size.z);
    43.             Vector2 pos = new Vector2(transform.position.x, transform.position.z);
    44.  
    45.             if (terrainRect.Contains(pos))
    46.             {
    47.                 MotionControllerMotion lMotion = mMotionController.GetMotion<Fall>(0);
    48.                 // will fall again
    49.                 mActorController.IsGravityEnabled = true;
    50.                 lMotion.IsEnabled = true;
    51.                 // enabling rigidbody
    52.                 mRigidbody.isKinematic = false;
    53.                 mRigidbody.detectCollisions = true;
    54.             }
    55.         }
    56.     }
    57. }
    58.  
    I am not sure why I needed to (maybe double gravity was being applied?) but I needed to set Rigidbody.useGravity = false to be able to jump. I am still getting to know how to use everything so maybe I was supposed to switch it off to begin with.
     
    Tryz likes this.
  22. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    Cool :)

    You definitely want it off all the time. The MC will manage the gravity.

    With a RigidBody, set it to IsKinematic and no gravity.
     
  23. wightwhale

    wightwhale

    Joined:
    Jul 28, 2011
    Posts:
    397
    Hey I'm trying to get the camera to follow the hips which have an idle animation on them and it's making the whole camera sway. Do you have any ideas on how to alleviate this issue?

     
  24. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    The CC is going to follow any transform you set as the Anchor. If that transform moves, the camera's going to move. It doesn't matter if that transform moves due to position being set or an animation... if the anchor moves, the camera moves. Setting the hips as the Anchor is usually not a good idea because animations move the hips a lot.

    Typically you would use the character's root (at the feet) as the Anchor and then set the Anchor Offset to be the height of the hips (if you want). Root-motion will move the root, but animations usually don't.

    You could add an intermediary like my Camera Anchor component. So, the intermediary would follow the hips, and the Camera Controller would follow the intermediary. That way you can create some smoothing or drag when the Camera Controller follows the Anchor (the intermediary).
     
  25. MateAndor

    MateAndor

    Joined:
    Nov 5, 2014
    Posts:
    70
    Hello! I downloaded the asset and works very nice, but how i can rotate the camera just with a joystick, not with mouse?
     
  26. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    If you're using the Unity Input Source, there's a checkbox that says "Is Xbox Enabled". That will enable the Xbox controller.

    If you want to actually prevent the mouse from rotating the camera, you'll need to create a custom Input Source that doesn't return mouse information in the ViewX and ViewY properties that the Input Source implements.

    Think of Input Sources as wrappers around your input solution. This is how my assets are able to work with any input solution. To learn more, check out this video:

     
  27. MateAndor

    MateAndor

    Joined:
    Nov 5, 2014
    Posts:
    70
    Thank, Im Try with CNControls Joystick not Xbox controller but I cant solve :/
     
  28. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    I see. In that case, you need to create a custom Input Source: CNControlsInputSource.

    If you look on the Vault, you'll find some examples of other Input Sources for Rewired and Easy Input 5.

    Basically, you're just creating a "CNControlsInputSource.cs" file and then filling out the ViewX and ViewY properties however you get the joystick entries.

    At 11:35 in the video, I talk about filling out the MovementY and MovementX properties (which is similar to ViewX and ViewY). However ViewX and ViewY control any camera rotation.

    Unfortunately, I can't afford to buy all the different input solutions that are out there. So, the logic you put in ViewX and ViewY is really up to how CNControls works.

    In the UnityInputSource.cs (which is the Input Source for Unity's native input solution), the ViewX logic is pretty simple:

    Code (CSharp):
    1. /// <summary>
    2. /// Retrieves horizontal view/camera movement from the the input
    3. /// </summary>
    4. public virtual float ViewX
    5. {
    6.     get
    7.     {
    8.         if (!_IsEnabled) { return 0f; }
    9.  
    10.         // Get mouse
    11.         float lValue = UnityEngine.Input.GetAxis("Mouse X");
    12.  
    13.         // Get Xbox
    14.         if (_IsXboxControllerEnabled && lValue == 0f) { lValue = UnityEngine.Input.GetAxis("WXRightStickX") * (Time.deltaTime / 0.01666f); }
    15.  
    16.         return lValue;
    17.     }
    18. }
    First we get the mouse value. Then, if there is no mouse value we'll get the Xbox controller's right stick value.

    Yours would be similar, but based on CNControls logic.
     
  29. Jick87

    Jick87

    Joined:
    Oct 21, 2015
    Posts:
    124
    Hey again. :)

    I'm not sure if this has been posted/requested before, so I figured I'd just post real quick to find out...

    Is there a possibility of having the camera slowly move back to a desired position if the anchor is moving and the user hasn't moved the mouse/joystick in a few seconds? Just like in GTA 5. So like, if the user is moving forward and has the camera looking at the anchor from the right side, if they haven't touched the mouse in a couple seconds the camera will slowly transition back to being behind the player. If the anchor is stationary then it would just stay where it is and not do anything.

    I'm using the 3rd person fixed motor because I like the way it works more than any of the other motors. Not sure if this is something that is included in other motors...

    Thanks as always!

    Aside: It would be cool to maybe have a FAQ section in the original post where it links to other posts in this thread that have the answers. Just an idea. :)
     
    MarkusGod likes this.
  30. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    The 3rd Person Follow motor has a similar feature as it will allow the anchor to pull the camera behind it when the anchor is moving. That means if the camera isn't actively orbiting it will get drug back to the "behind the character" position.

    The 3rd Person Fixed won't do that automatically. It's yaw/pitch stays fixed even as the anchor moves and rotates.

    However, what you're asking is definitely doable by controlling the CC through code. This allows you to force the action when you want (ie the mouse hasn't been touched in a couple of seconds). For example, you can use the CameraController.SetYawPitch() function to control how the camera is positioned around the focus. It's arguments allow this to happen instantly or over time.

    Check out the documentation (page 27) to see how you can tap into the CC at run-time.
    http://www.ootii.com/Unity/CameraController/CCUsersGuide.pdf

    That gives you the flexibility to make exactly what you want.


    Another thing to think about is a "camera anchor". This allows you to disconnect the Camera Controller from the character in order to add things like delays and drags. You can also control the rotation by rotating the camera anchor separate from the character (and checking the fixed motor's "Rotate With Anchor" option).

    Check out this page to learn more:
    Camera Anchors
     
    Jick87 likes this.
  31. MarkusGod

    MarkusGod

    Joined:
    Jan 10, 2017
    Posts:
    168
    Hi @Tryz! Is it possible to use your fps camera when a character is free to rotate on all axis? My current solution works fully in local space and missing tons of features, but I just remembered that you already have done cool cam controller.


    EDIT: Ok nevermind, it just working out of the box.
     
    Last edited: Feb 11, 2018
  32. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    hahaha... Glad you saw that. Sorry for the delay. :)
     
    MarkusGod likes this.
  33. Jick87

    Jick87

    Joined:
    Oct 21, 2015
    Posts:
    124
    @Tryz Will a custom motor be required if I want the FPS motor but without rotation-matching? Like, so the camera sticks to the same position as the Anchor, but does not match the Anchor's rotation. The only rotation it would have is from direct input, like the mouse. The default FPS motor also matches the rotation of the Anchor and I was looking to avoid that. Will I need to make a custom motor for that?

    Thanks as always!
     
  34. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    I thought it was already an option on the 1st Person View motor, but it's not. However, we can add it pretty easily by changing line 195 to these:

    Code (CSharp):
    1. bool lMatchRotation = _IsActorMatchingRotation || ((_MinYaw > -180f || _MaxYaw < 180f) && (LocalYaw <= _MinYaw || LocalYaw >= _MaxYaw));
    2. Matrix4x4 lOldMatrix = Matrix4x4.TRS(mAnchorLastPosition, (lMatchRotation ? mAnchorLastRotation : lAnchorTransform.rotation), Vector3.one);
    and then uncheck "Anchor Rotates".

    If you have limits setup on the yaw of the motor and then you rotate the character so it exceeds those limits, the motor will try to force the camera to rotate to stay in those limits.

    If you don't want limits, make sure you set the range to -180 and 180.

    Let me know how that works for you. :)
     
    hopeful and Jick87 like this.
  35. Jick87

    Jick87

    Joined:
    Oct 21, 2015
    Posts:
    124
    It doesn't seem like it fixed the issue for me. I'm not sure if it's related to my specific case or not though...

    I have the rig setup to follow the head bone of my character. Because my character has animation that means the bone is moving and rotating constantly.

    It seems that even with that change my camera is always tilted (around the Z axis I believe, as if I were tilting my head to the left or right). And I can still see it rotating if I watch the rig's transform during play. I mean, I can see the rotation values changing on their own even if I'm not touching the mouse. I'm guessing that is because it is still following the rotation of the anchor to some degree.

    I also made sure to have that checkbox unchecked.

    Thanks for the quick reply! :)
     
  36. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    It sounds like you might have a dangerous setup.

    Check out this post about first person setups:
    Can I use the MC with a first person setup?

    While I wrote it for the Motion Controller, it really applies to any character controller. Give it a read and feel free to shoot an email to tim@ootii.com if you have any more questions.

    (Please include your Unity Order ID) :D
     
    boysenberry likes this.
  37. Jick87

    Jick87

    Joined:
    Oct 21, 2015
    Posts:
    124
    Ok, I got it figured out...

    I changed it so that the camera rig is set to follow the root transform of my character, and then in my player controller script's Update() method I constantly keep the AnchorOffset value of the camera rig updated to the relative position of my character's head bone. That seems to do what I want and doesn't have any of the weird rotation issues.

    Thanks as always for the great support! :)
     
    Tryz likes this.
  38. Jick87

    Jick87

    Joined:
    Oct 21, 2015
    Posts:
    124
    @Tryz Oh by the way, I did still end up needing that code change you provided for the first person motor. Will that change be included in a future update? Thanks!
     
    Tryz likes this.
  39. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    Yes. I'll make it part of the next update.
     
    Jick87 likes this.
  40. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    Unfortunately, no. I've never seen that but it looks like it has something to do with Unity's editor.

    I just did a fresh download and import into a new U2017.3.0f1 project and everything was fine. Then, I built my test scene into a windows EXE and that was fine too.

    If you didn't, maybe try importing it into a new project by itself. If that works, maybe there's something else wrong with the original project. I'm just not sure.
     
  41. Jick87

    Jick87

    Joined:
    Oct 21, 2015
    Posts:
    124
    I think I had that same issue a while ago (if I'm remembering correctly). I think the way to fix it was to delete either your project's shader cache or the entire library folder and let Unity rebuild it. Not 100% sure as I could be remembering incorrectly, but I guess it's worth a shot.
     
  42. Griffo

    Griffo

    Joined:
    Jul 5, 2011
    Posts:
    700
    Thanks for heads up, but sadly none of those fixed it .. :(
     
  43. Griffo

    Griffo

    Joined:
    Jul 5, 2011
    Posts:
    700
    @Tryz looks like it's 2017.3.0f1, NOT your CC, trying a few thing to correct it .. I'll remove the above posts as not to confuse anyone.

    EDIT - Don't know what it was but I done Assets/Reimport All and it's fine now ..
     
    Last edited: Mar 5, 2018
    hopeful and Tryz like this.
  44. TreeFallStudios

    TreeFallStudios

    Joined:
    Mar 22, 2018
    Posts:
    11
    Hello!
    I have a quick question. I just purchased the camera from the asset store. I set it up in my first level, it took a bit but I got it at the distance I want and all the values I want. Then I tried to duplicate that process, and set the camera up in more levels. I have tried in two different levels, and each time, the values are exactly the same on the camera controller in the inspector, and the player is selected for the anchor. However, when the scenes run, the camera moves back to a really far away and offset position, much much farther out than the close distance I set on the camera controller. When I look at the inspector on the camera during runtime in the scene view I can see that both times, in different scenes, numbers fill up the camera's position and rotation, even though I had it all set to 0,0,0 in the inspector before runtime. I am not sure what is causing this warp of positioning, I cannot get the camera to work in any new scenes. Any help with this? I'm not sure what is causing the values to change at runtime.
     
  45. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    Without seeing your setup, I'd guess that you put the CC inside your character hierarchy. That can cause an endless loop of movement since the camera's anchor would be based on itself.

    Feel free to email tim@ootii.com some screenshots of your hierarchy and setup and I'll help how I can. Please include your Unity Order ID. :)
     
  46. jhocking-ICS

    jhocking-ICS

    Joined:
    Sep 19, 2017
    Posts:
    1
    Hi I'm using your camera system and trying to work out a possibly obscure use-case with the cameras: is there a way to tell when a camera motor is operating? Ideally with a property on the camera motor that I can query, but an event or something would work too. Camera motors have an Activated property, but even an active camera isn't necessarily doing anything; I want to know if the camera motor is actually operating/doing anything, versus just sitting there waiting.
     
  47. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    Unfortunately, the "IsActive" property on the motor is the closet thing. Like you said, the "active" motor will have IsActive set to true, but if the character isn't moving and player isn't moving the mouse... IsActive is still true.

    I'm not 100% sure what your definition "of doing anything" is. Are you only wanting the value to be "true" if the camera is actually moving or rotating? If that's the case, you might be able to look at the LocalYaw and LocalPitch values plus the position. If any of those change from frame-to-frame, you could call that "doing something".

    I hope that helps.
     
  48. Jick87

    Jick87

    Joined:
    Oct 21, 2015
    Posts:
    124
    You've probably already seen this, but I figured I would post anyway just in case. In 2018.1.0f2 I get these two warnings:
    Nothing super important, but maybe something to check out for future versions.

    Thanks as always for your great support! :)
     
  49. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    Hey @Jick87 ,
    I did see the warnings. That's pretty normal for major updates like Unity 2018.

    I'll definitely address it before they turn the warning into an error.
     
  50. FenixOfGreen

    FenixOfGreen

    Joined:
    Oct 2, 2017
    Posts:
    22
    Hey Ootii, I got a question. First, Love the Camera Controller Exactly what i needed. Second, my question is, (3rd person style )is there a way to set the default Y position? Also is there a way for the Pitch to spring back to its original position? like if i move the camera up then let go if the mouse button to active the rotation or the anolog stick it will go back to where it started? Thanks