Search Unity

  1. Check out the Unite LA keynote for updates on the Visual Effect Editor, the FPS Sample, ECS, Unity for Film and more! Watch it now!
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. Improved Prefab workflow (includes Nested Prefabs!), 2D isometric Tilemap and more! Get the 2018.3 Beta now.
    Dismiss Notice
  4. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice
  5. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice

Camera Controller Release

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

  1. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    656
    Yes, it is. Just set the View Activator property on the Unity Input Source to "none":

    upload_2018-9-11_10-53-2.png
     
    Tryz likes this.
  2. eblumrich

    eblumrich

    Joined:
    Nov 12, 2015
    Posts:
    46
    Awesome!
     
    Tryz likes this.
  3. sky_dragon

    sky_dragon

    Joined:
    May 27, 2016
    Posts:
    11
    This asset is very good, but can you tell me that the files are necessary, the entire asset is too big, I am not very programming, thank you!
     
  4. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,036
    The update I'm working on will get rid of this demo bloat. For now, you can get rid of these folders:

     
    Willbkool_FPCS and hopeful like this.
  5. sky_dragon

    sky_dragon

    Joined:
    May 27, 2016
    Posts:
    11
    Thx for your replying, one more question is where is the Object Browser? PS: TIM图片20180915220321.png
     
  6. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,036
    It's in your development environment (Visual Studio or Monodevelop). I use Visual Studio and you can find it under the 'View' menu item. I know Monodevelop has it too... I just forget where it's located.
     
  7. sky_dragon

    sky_dragon

    Joined:
    May 27, 2016
    Posts:
    11
    Thx!!!
     
    Tryz likes this.
  8. dinhvanvo1987

    dinhvanvo1987

    Joined:
    Aug 4, 2018
    Posts:
    1
    I have a question: How to rotation camera when mouse move? (don't use left mouse or right mouse)
     
  9. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,036
    Just set the View Activator property on the Unity Input Source to "none":

     
  10. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,036


    Before updating, PLEASE READ THIS!

    This update REQUIRES that you delete your 'Assets\ootii' folder and re-import the assets.

    Today I'm pushing up a massive update to all my assets. The primary goal is to support Unity's Assembly Definition Files, but there's some other cools stuff as well:

    1. Assembly Definition File support
    2. New character wizard (for the Motion Controller)
    3. Restructure folders so demo files are in one place (easy to remove)
    4. Smaller download size

    Please back-up your project and wait for all my assets (that you own) to be updated by Unity. :)

    As always, I'm here to help.
     
    hopeful and Willbkool_FPCS like this.
  11. silentneedle

    silentneedle

    Joined:
    Mar 14, 2013
    Posts:
    271
    @Tryz was this added in the last update? If not, could you provide me a temporary solution?

    Another q, how would you add a recoil to the camera controller?
     
    Last edited: Oct 1, 2018
  12. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,036
    I didn't for the last push as I was trying to minimize changes. However, you can add this to the YawPitchMotor.cs class (line 320).

    Code (CSharp):
    1.         /// <summary>
    2.         /// Determine if a target yaw, pitch, for forward is set
    3.         /// </summary>
    4.         public bool IsTargetSet
    5.         {
    6.             get
    7.             {
    8.                 if (mTargetYaw != float.MaxValue) { return true; }
    9.                 if (mTargetPitch != float.MaxValue) { return true; }
    10.                 if (mTargetForward.sqrMagnitude != 0f) { return true; }
    11.  
    12.                 return false;
    13.             }
    14.         }
    This will allow you to test the active motor (by converting it to a YawPitchMotor first.

    Code (CSharp):
    1.             YawPitchMotor lMotor = this.ActiveMotor as YawPitchMotor;
    2.             if (lMotor != null && lMotor.IsTargetSet)
    3.             {
    4.                 // ...
    5.             }
    This will be part of the next push.
     
    silentneedle likes this.
  13. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,036
    You've got a couple of options:

    1. Call the CC.Shake(range, strengthX, strengthY, duration) function. With this, I'll do a random camera shake.

    2. Shake or recoil using just the Main Camera. This is what I do with my shake... I wiggle the Main Camera that's inside the Camera Controller. Then, I put the Main Camera back to 0, 0, 0 when done. This works nice because it doesn't change the CC's position relative to the character, but it does create a movement effect.

    3. If you really want the whole camera angle to change permanently like I do in my Shooter Motion Pack, you can use the SetTargetYawPitch() function. I grab the local yaw & pitch, add the values I want, and call the function.
     
    silentneedle likes this.
  14. silentneedle

    silentneedle

    Joined:
    Mar 14, 2013
    Posts:
    271
    Thanks, that works, but it does seem to return true sometimes, even if SetTargetYawPitch is finished, any idea?
     
  15. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,036
    Is it taking longer than you expect to return 'false' or is it just never doing it?

    If the SetTargetYawPitch() includes the 'auto clear' parameter (which is true by default), it should reset the target variables when the goal is reached. I can see it taking longer if the character is rotating while the camera is rotating... but, it should eventually get there.
     
  16. silentneedle

    silentneedle

    Joined:
    Mar 14, 2013
    Posts:
    271
    Auto clear is set. It keeps locked and the camera rotation doesn't change at all.

    edit: I've found another problem with the latest version, when building the player I receive the following error:

    Code (CSharp):
    1. Assets/ootii/Assets/Framework_v1/Code/Helpers/AssetHelper.cs(5,7): error CS0246: The type or namespace name `UnityEditor' could not be found. Are you missing an assembly reference?
    edit2:

    When calling
    Code (CSharp):
    1. cameraController.SetTargetYawPitch(0, cameraMotor.LocalPitch, 200f);
    mTargetYaw (sometimes!) keeps 0 instead of float.MaxValue.
     
    Last edited: Oct 4, 2018
  17. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,036
    I've just pushed out updates to fix the build error.

    You won't need to delete 'Assets/ootii' for this update. It will just go on top of the last update.

    I'm not seeing that in my tests, but it may have to do with your exact setup. It's probably best if you just email me a small project where this is happening. This way I have your exact settings and calls.

    Please email it to tim@ootii.com.
     
  18. Michal_Stangel

    Michal_Stangel

    Joined:
    Apr 17, 2017
    Posts:
    17
    Hello,

    Is there any event firing every time when camera position, rotation or FOV has been changed? I currently use "MotorUpdated", but it fires every frame. I used it to recalculate frustum height and deriving scale of health bars and floating texts from that. But it seems to be a bit unnecessary do it even if camera doesn't move.
     
  19. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,036
    No, just the "MotorUpdated" event you found.

    Since I'm moving the Camera Rig GameObject, you could have an external component that checks for a position or rotation change and then do your work. It's just not something that's inside the Camera Controller directly.
     
  20. Mijndert

    Mijndert

    Joined:
    May 5, 2017
    Posts:
    3
    Hi, I use the camera controller on a tank. It works perfect when not moving, but when I start driving the camera wants to look forward, so it's hard to look around when driving. Is there an easy fix for this?
     
  21. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,036
    If you're using one of the 3rd Person motors, that's expected as the camera rig is always going to try to look towards the anchor. If you're moving forward, the cameras will be pulled along and tend to move behind the anchor causing them to look forward. This is the way traditional action adventure games like Assassin's Creed and Tomb Raider work.

    For a tank, I'm really not sure what you're trying to achieve. But, you may find one of the other camera motors (ie the 1st Person motor) works best.

    I did have someone use the CC with a car racing game and that seemed to have worked well for them. They used transitions to activate different camera views. However, I don't know about the tank.
     
  22. Mijndert

    Mijndert

    Joined:
    May 5, 2017
    Posts:
    3
    I have a 3rd person view of the tank like this, Tank.png and the tank's turret is rotated to where you look. When not moving I can look around and this works fine. Is there no way to edit the code so it's the same when moving?
     
  23. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,036
    Ok. That was different than what I was thinking.

    Use the 3rd Person Fixed motor and make sure "Rotate With Anchor" and "Rotate Anchor" are not checked. That will allow you to rotate the camera while moving. Obviously you'll have to rotate the tank some other way.

    As an example, open my demo_3rd_Person_Style scene then, ensure the Camera Controller looks like this:


    When you hit 'play' and press 'W', the character will move forward and you can continue to orbit around him with the RMB pressed... the character's direction won't change.
     
  24. Mijndert

    Mijndert

    Joined:
    May 5, 2017
    Posts:
    3
    Thank you! This was exactly what I was looking for, it works perfectly now.
     
    Tryz likes this.
  25. Cywizz

    Cywizz

    Joined:
    Oct 5, 2017
    Posts:
    14
    I just bought this asset with both your input and motion controller and I must say your quality and documentation is fantastic! The motion controller saved me a hell of a lot of time and everything is really well structured.

    The last few days I picked up something strange and I am hoping you could guide me in the right direction.

    Here is my setup:
    I have an UMA character setup with your motion controller and it works great. I use the adventure style third person view and the distance from the anchor is 3.
    Now every now and then, when I run the game, the camera moves into first person view. When I stop the game and change the distance to 4, then it works again for a few times. (+- 3-5 times). Then all of a sudden it happens again and I go back and change the distance again back to 3 and rinse and repeat.

    Is there something I might be doing wrong or should look out for?

    Thanks!
     
  26. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,036
    It almost sounds like the zoom feature is kicking in. Can you try disabling zoom to see if it still happens?

    If it doesn't, than it's probably your mouse wheel is sending a signal and I'm registering that as a zoom.
     
  27. Cywizz

    Cywizz

    Joined:
    Oct 5, 2017
    Posts:
    14
    I will try tonight and let you know. I can confirm that I have zoom enabled because when I am in 3rd person, I can zoom closer to the character, but not all the way to 1st person...
    I will disable and see if this changes
     
  28. Cywizz

    Cywizz

    Joined:
    Oct 5, 2017
    Posts:
    14
    @Tryz I disabled zoom but the issue is still there. Something is setting the Distance to 0 upon start.
    I delved in a bit more and added breakpoints in your code and this is what I found:

    In you CameraMotor class in the DeserializeMotor method line 831 you have the following line:

    lProperty.SetValue(this, lValueNode.AsFloat, null);
    I looked the the value of IValueNode which equals: \"4.00000\" but the .AsFloat converts it to 0

    The portion of the rDefinition parameter passed into the function has the following JSON value:
    \"Distance\" : \"4.00000\"
    So the above sets the Distance property on the OrbitFollowMotor class to 0 on startup, which seems weird.

    After this, it worked for a while and I could not recreate the issue consistently.
    However, I then saved the project and restarted it a few times, and every time the Distance property is set to 0 on Unity startup. So deserialization has some issue, somewhere.
     
  29. SickaGamer

    SickaGamer

    Joined:
    Jan 15, 2018
    Posts:
    217
    Will this camera be a replacement for Invector's TPC Shooter camera and would I be able to use the mousescroll to transition from 3rd Person to 1st Person view? If so, how?
     
  30. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,036
    What's odd is that no one else is reporting an issue and I can't reproduce it.

    I'm wondering if it's a number formatting issue based on your country. What country are you in and how do you represent your numbers?
     
  31. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,036
    I'm not familiar with TPC's shooter camera.

    You cannot use the mousescroll to transition like that automatically. You would have to write code that activates the transition motor when you want. So, the behavior is possible with some small bit of management code based on when you want the transition to occur.
     
  32. Cywizz

    Cywizz

    Joined:
    Oct 5, 2017
    Posts:
    14
    Hi, thanks for the reply. My localization is set to en-za (South Africa) but I am not sure how this may cause an issue. It is only this one field that is giving me a hard time.
    The only thing I can think of that might be different is that I first installed the motion controller and got everything up and running with the toned down camera controller that you ship with it. The problem already started there.
    Then only did I install the full camera controller asset hoping that it might resolve it.

    I have added a small injection script to set the value on the camera controller manually on awake, so it is not a big deal for now...thanks again for your help @Tryz