Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Camera Controller Release

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

  1. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,323
    Hi @malkere , the orbit speeds (yaw and pitch) are frame rate independent. So, lag spikes shouldn't effect them. However, you could see some popping on extremely slow frame rates.

    I did some tests and I'm not seeing acceleration issues. If you want to do a video and email it to tim@ootii.com, I'll look (typically on weekends) and see if there's something I can see.
     
  2. bavollee

    bavollee

    Joined:
    Jan 26, 2016
    Posts:
    17
    Hi, ootii team,
    Your product is nice and easy to use.
    But when I try to test the CameraController demos in my android phone, it is not what I expected. Does the input source could not support mobile phone by touch?
    For example, to zoom the camera view, I can use mouse scroll button to zoom up and down. But in mobile phone, I can't zoom the camera view by two fingers.
    For example, to rotate the camera view, I can use mouse right button to zoom up and down. But in mobile phone, I can't rotate with any finger operations.
    The demos only can run in Windows target?
    If I want to use in mobile phone with fingers operations, what should I do? Is there a setting for switch PC to Android or iOS.
     
  3. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,323
    Hey @bavollee ,

    A quick start is to just change the "View Activation" parameter on the Unity Input Source to be "None". Now it will just work with any touch & drag on a mobile device.

    By default I'm using the Unity Input Source... that uses Unity's native Input Manager. So, you could edit Unity's Input Manager to reference the touch inputs you want. For example, update my "Camera Zoom" entry to use the mobile inputs however Unity's Input Manager does it.

    The best answer is really an Input Source that uses whatever input solution you use. Check out this post on Input Sources. In this case, you can customize your input source to read any kind of input; pinch, drag, tap, etc. Or, you can reference another input solution like Rewired or Easy Touch 5.

    I don't have a custom mobile input source out of the box. I just use Unity's native Input manager.
     
    bavollee likes this.
  4. bavollee

    bavollee

    Joined:
    Jan 26, 2016
    Posts:
    17
    Thank you for your answer. This answer is so helpful and warm. I'll take your tips. ^_^
     
    Tryz likes this.
  5. Skotrap7

    Skotrap7

    Joined:
    May 24, 2018
    Posts:
    77
    I'm having an issue where the camera is "pushing" the target forward. Basically, as soon as I start the scene the camera bumps into the player and pushes the player forward, then "follows" the player and pushes it again. I've gone through the documentation and have setup the controller as suggested. It seems like it has something to do with the collision system, if I turn off "Test Collisions" then it is fine, except that the physics of the player seem to stop working.

    Really confused here, and not familiar with your asset. Any ideas?
     
  6. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,323
    If I had to guess, did you nest the Camera Rig in the character? If so, this would definitely happen.

    In the documentation, I mention not to nest the Camera Rig. That's because the character and camera have a circular relationship and you don't want them "pushing" each other.

    Check if that's the case. If so, disconnect them. I hope that helps.
     
  7. Skotrap7

    Skotrap7

    Joined:
    May 24, 2018
    Posts:
    77
    No, the rig is at the top of the hierarchy. I do have a rigid body and a sphere collider on the main camera for some physics and sound effect related stuff though, could that be it?
     
  8. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    915
    That sounds likely. I would try putting the CameraController's GameObject on a layer that is excluded from collisions with the player's layer in Project Settings -> Physics -> Layer Collision Matrix.
     
    Tryz likes this.
  9. Skotrap7

    Skotrap7

    Joined:
    May 24, 2018
    Posts:
    77
    Yea, definitely was the sphere collider on the camera if anyone experiences this in the future.
     
  10. Skotrap7

    Skotrap7

    Joined:
    May 24, 2018
    Posts:
    77
    My player model uses root motion and has an animation that is a bit shaky (intentionally), which causes the anchor point to shift a bit while moving, which results in the camera bouncing side to side a little. Any ideas on how I can prevent the camera from doing this little wobble?
     
  11. Skotrap7

    Skotrap7

    Joined:
    May 24, 2018
    Posts:
    77
    This has something to do with using root motion. Going to look into my rig and animation keyframes and see if I can find a stable transform for the camera rig anchor.
     
    Last edited: Jun 18, 2020
  12. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,323
    You could use a third object to follow your character and do smoothing that you want. Then, have the Camera Controller follow that. I include a "Base Camera Anchor" component for that kind of control.

    Check out these posts:
    Camera Anchor
    Base Camera Anchor
     
    TeagansDad likes this.
  13. bavollee

    bavollee

    Joined:
    Jan 26, 2016
    Posts:
    17
    Hi, Tryz, there are many compile errors when I build a windows standalone target. The follow errors just like:

    Assets\ootii\Editor\CameraController\CameraControllerEditor.cs(7,7): error CS0246: The type or namespace name 'UnityEditorInternal' could not be found (are you missing a using directive or an assembly reference?)

    Assets\ootii\Editor\Framework_v1\Utilities\Coroutines\EditorCoroutineExtensions.cs(17,70): error CS0246: The type or namespace name 'EditorWindow' could not be found (are you missing a using directive or an assembly reference?)

    Assets\ootii\Editor\CameraController\CameraControllerEditorSymbol.cs(6,3): error CS0246: The type or namespace name 'InitializeOnLoadAttribute' could not be found (are you missing a using directive or an assembly reference?)

    and so on. And I've tried to modify it many times, also search google many times.
    If you also encounter this problem, feel free to respond me and thank you very mush. Sorry to bother for such question.
     
  14. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    915
    Have you removed the ootii.Editor assembly definition file (.asmdef) or modified it in any way? Check its properties and make sure that it's set to the Editor platform only:

    upload_2020-6-18_14-25-9.png

    The errors that you are reporting are what you usually see when you run a build and there are references to UnityEditor classes in your runtime assemblies (Assembly-CSharp.dll is where everything is compiled to by default).

    There are a number of files in the ootii runtime code base that reference UnityEditor classes, but that code is contained within #if UNITY_EDITOR ... #endif directives, so when you're building for a standalone platform, the code will not be compiled.
     
    Tryz and bavollee like this.
  15. Skotrap7

    Skotrap7

    Joined:
    May 24, 2018
    Posts:
    77
    Probably going to drop root motion, even with an empty game object following behind applying a generous amount of smoothing on the wobble, the wobble is still a bit ugly for the player.

    In the meant
    Well, this did help quite a bit, but there is still enough of a wobble that we may decide to either drop root motion, change the animation, or just live with it.

    If we end up solving it I'll post a solution here for others if they might want it.
     
    Tryz likes this.
  16. bavollee

    bavollee

    Joined:
    Jan 26, 2016
    Posts:
    17
    Thanks very much, TeagansDad! Yep, it works. It's the "Assets\ootii\Editor\ootii.Editor.asmdef", I changed it so it came to the problem. I made it back and take some other stuffs.
    You guys are so friendly, and reply quickly. I'm thankful and best regards.
     
    Last edited: Jun 19, 2020
    Tryz and TeagansDad like this.
  17. Pollawat

    Pollawat

    Joined:
    Aug 27, 2016
    Posts:
    173
    Hello sir I have a question. I'm using the MOBA demo.



    As you can see here. How to prevent the camera from passing through the terrain or any object that has collider?

    Thank you.
     
  18. bavollee

    bavollee

    Joined:
    Jan 26, 2016
    Posts:
    17
    Do you enable the colliding function? You can editor it in inspector view, like the picture below:
    Snipaste_2020-06-28_10-45-29.jpg

    Make sure your terrian or ground's layer is the collision layer. The author provide us a convenient way to setup camera collision.
     
    Tryz likes this.
  19. bavollee

    bavollee

    Joined:
    Jan 26, 2016
    Posts:
    17
    Hi, ootii team, sorry to bother you~
    The UIBinding.cs is origin in project. I just import 'Camera Controller' to the exist project and do nothing.
    When I run the project again, it comes many werid problems. Such as the UIBinding.cs goes wrong:
    goes_wrongss.jpg
    It couldn't not find other nodes when the ootii folder is exist. But when I delete the ootii folder, the project is normal back.
    Does the Camera Controller modified sth or affect some code functions to my origin project? Like Scripting Define Symbols(Project Settings/Player) or somewhere?
    Best regards!
     

    Attached Files:

  20. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    915
    Yes; in the file CameraControllerEditorSymbol (under the "Editor" folder hierarchy), is an [InitializeOnLoad] class that sets the scripting define symbol OOTII_CC if it is not already set.

    Not sure why that would cause the problem you're experiencing though.
     
    bavollee likes this.
  21. bavollee

    bavollee

    Joined:
    Jan 26, 2016
    Posts:
    17
    OK, thanks for this reply. I'll keep going to debug and try to figure out this weird problem. I think it's my origin project's reason.
    If any update or solved way, I'll update here for share.^_^
     
    TeagansDad likes this.
  22. bavollee

    bavollee

    Joined:
    Jan 26, 2016
    Posts:
    17
    Hi, ootii team and TeagansDad, I had solved the problem. It's my origin script which will conflict with Text.cs("\Framework_v1\Code\Graphics\Text.cs"). I change the Text.cs to CCText, it seems be OK now.
    Thanks for attension.
     
    Tryz likes this.
  23. bavollee

    bavollee

    Joined:
    Jan 26, 2016
    Posts:
    17
    Hi, ootii team and the community friends, I followed the prompts you gave and tried several times. I had try the android target on my phone, but the input still not work. For clean test, I just try the demo from CC(ootii\_Demos\CameraController\Scenes\demo_3rd_Person_Style.unity).
    Question:
    In my windows PC, I can use mouse to drag the screen so that the camera can rotate with. And use the wheel button(middle mouse button) to Camera Zoom, and so on. But when I package the demo to an android apk and install in my phone, when I touch the screen, both one finger to drag or two finger to zoom are failed. The camera is chaotic when I touch the screen.
    Clean test:
    I just use the demo scene "demo_3rd_Person_Style.unity" for test. I had try the Input Source's view Activator's any state, it all failed.
    Does mobile device support require me to write other code or use the mobile touch extension?
    Confuse:
    I mean the demo is normal on the PC, and the input support on the mobile phone is not provided, right?
    You said that you didn’t use other plugin such as EasyTouch, and you used Unity’s origin input manager. How do you handle touch and zoom on android phone with unity input like you said in your demo?
    Sorry to bother this thread again. I have just studied unity for several weeks, and I'm very happy to learn from all of you.
    Thanks again!
    cc_input.jpg
     
  24. autumn_737

    autumn_737

    Joined:
    Jul 23, 2012
    Posts:
    17
    Hi bought camera Controller, loving it so far.
    What's the best way to go about doing 3rd person aiming, like with a bow and arror? I want to move closer to the character and focus on a point but retain movement with character.

    Regards,
    Josh
     
  25. bavollee

    bavollee

    Joined:
    Jan 26, 2016
    Posts:
    17
    You can use the Camera Motors with Targeting. With the right mouse button, you can Targeting In or Target Out.
    targeting.jpg
     
    Tryz likes this.
  26. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,323
    Hi @bavollee ,

    I typically do support on the weekends. So, sorry for the delay. I'm glad @TeagansDad was able to help on the other stuff.

    For mobile devices, you may need to customize the Input Source. Because there's are lots of different input solutions and input devices (game pads, keyboards, tab screens, etc), I abstract the input solution. That means for things like zoom and rotations on a mobile device with no buttons you'll want to customize what activates the input and ramps the value.

    Please check out this post. It and the video should help:
    Input Sources

    For something like zoom, the Camera Controller uses the "Zoom Action Alias" property to zoom in & out. That means in your mobile input source, you'd return values like -0.1 or +0.1 for the "Zoom Action Alias". You could tie that to a pinch, a scroll bar, a dial, etc. In the end, you're just returning the value.

    Check out the post. If it still doesn't make sense, feel free to email tim@ootii.com.
     
    bavollee likes this.
  27. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,323
    Hi @autumn_737 ,

    @bavollee is right. You'd use different "motors" to represent the different views. I use the setup he shows above to have my bow & arrow view be just over the shoulder. The transition motors move you between the different "views" with a button press.

    Check out the User's Guide. I talk about it on page 23.
     
  28. bavollee

    bavollee

    Joined:
    Jan 26, 2016
    Posts:
    17
    Yep, I've got your points. I need to implement the touch or zoom behaviour in my script or use third-party input, then implement the IInputSource interface.
    Thank you so much. Both you and @TeagansDad are warm-hearted.
    Best regards.
     
    Tryz likes this.
  29. Skotrap7

    Skotrap7

    Joined:
    May 24, 2018
    Posts:
    77
    Hi, in my game we have objects that the player can interact with. We want the user to "select" or "click" (whatever word you want to use) an object and have the camera transition to a fixed straight down view of the top of the object. I have transitions setup to let the player go in-and-out of this view, but I'm having a bit of a struggle getting it to work the way I would like. I've been debating between using your fixed motor and its API to handle the positioning of the camera motor relative to the object, but given that our objects can be different from one to the next I'm not getting the visual flow that we want.

    Is there a better motor I can use for this, where I could assign an offset for the camera and then specify a "target" anchor at runtime for the transition? Should I be looking at building a custom motor here instead?

    I should add, I "almost" have what I want with a transition with the fixed motor, but would like to create a smoother motion during the transition. Any suggestions welcome.
     
    Last edited: Jul 21, 2020
  30. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,323
    Hey @Skotrap7 ,

    I think I understand. For bouncing the camera between targets (especially if there's a lot of them), I typically use a separate Camera Anchor.

    Check out these posts and see if they help:
    Camera Anchor
    Base Camera Anchor
     
  31. Skotrap7

    Skotrap7

    Joined:
    May 24, 2018
    Posts:
    77
    So would I be just switching the anchor of the rig, or switching what the anchor is "following" ?
     
  32. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,323
    Have the Camera Controller follow the new game object (I'm calling that the Camera Anchor) instead of the character. In side the Camera Controller's inspector, you would set the "Anchor" property to this new game object.

    From the post I linked to above:




    Now, you can move this new game object around and attach it to any other object you want. You can do any kind of smoothing or control you need. So, this new game object would jump between the targets and the Camera Controller will just follow it.

    You don't have to use my "Base Camera Anchor" component I provide. It works, but it's just an example. You can move your new game object any way you want and the Camera Controller will follow.
     
    Willbkool_FPCS likes this.
  33. EmeralLotus

    EmeralLotus

    Joined:
    Aug 10, 2012
    Posts:
    1,340
    Hi, my project is using unity's new input system and seems that many errors are popping up.
    Is it possible to add support for unity's new input system.
     
  34. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,323
    I'll look at it this weekend or the next.

    I'm surprised that errors are being generated since it would be a new system and the standard one still exists. I'm not sure why they would introduce something that would cause errors, but I'll check.

    [EDIT]
    I started playing with the new input system and it looks like it disables the default Unity Input Manager when the new input system is imported. Unfortunately, this may take me some time to work through.
     
    Last edited: Sep 27, 2020
unityunity