Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Master Camera: Scroll/Zoom, Strafe, FPS-3PS Toggling, Minimal/No Clipping and More

Discussion in 'Assets and Asset Store' started by tzvier, Dec 8, 2011.

  1. tzvier

    tzvier

    Joined:
    May 20, 2010
    Posts:
    355
    Check that "Enable Camera Collision" is enabled on the MCScroll script.
     
  2. EmeralLotus

    EmeralLotus

    Joined:
    Aug 10, 2012
    Posts:
    1,459
    Hi MasterCamera,

    We are working on need a certain feature and I thought that MasterCamera would be a possible solution. Please let me know if something like the following can be done.

    Situation: We took the Mecanim NavMesh example and tried to setup the camera so that it does the following. This example is a bear running towards a point where the mouse has been clicked. It uses a NavMesh and mecanim blend trees.

    A. ( Camera goes from following him BEHIND to following his RIGHT side.)
    1. We begin with the Camera facing the Back of the Character.
    2. Mouse click to the RIGHT and a little behind the character, the camera dolly around his right side and shows him running toward the right as he runs towards the clicked target.

    B. ( Camera goes from following him from BEHIND to following from his LEFT side.)
    1. We begin with the Camera facing the Back of the Character.
    2. Mouse click to the LEFT and a little behind the character, the Camera rotate to his right and follows him as he runs towards the clicked target.

    C. ( Camera goes from following him from BEHIND to following to the FRONT.)
    1. We begin with the Camera facing the Back of the Character.
    2. Mouse click on a spot BEHIND of the character, the character turns around and runs towards the hit point. The camera rotates around to face his FRONT and follows him - it's like hes' running towards the camera and the camera is dollying backwards.

    D. ( Camera goes from facing his FRONT to following him from BEHIND.)
    1. We begin with the Camera facing the FRONT of the Character.
    2. Mouse click on a spot BEHIND of the character, the character turns around and runs towards the hit point, the camera faces his back and follows him from behind.

    Would something like the above scenario doable with MasterCamera?

    Thanks.
     
  3. tzvier

    tzvier

    Joined:
    May 20, 2010
    Posts:
    355
    So MasterCamera doesn't handle character control. The click to move functionality is something you would have to come up. Other than that, it sounds like a follow camera with a low rotation speed, unless there is something I am missing.
     
  4. Gekigengar

    Gekigengar

    Joined:
    Jan 20, 2013
    Posts:
    738
    Posted a comment on the store, Love this camera system!,


    I wish there is a Default Strafe Position option to be set on the Component.

    Since its weird that you start at the centre, and when you strafe, there is no way to get it back to the centre,

    as if its made to strafe either left/right as a default.
     
  5. tzvier

    tzvier

    Joined:
    May 20, 2010
    Posts:
    355
    Currently if you set the MCStrafe > Left Key Input, and Right Key Input to be the same key, it will start out over the right shoulder and the key will snap back and fourth to the opposite limits. Does that work for you?
     
  6. Gekigengar

    Gekigengar

    Joined:
    Jan 20, 2013
    Posts:
    738
    Great!, it worked!, thanks!
     
  7. Hamesh81

    Hamesh81

    Joined:
    Mar 9, 2012
    Posts:
    405
    Hi tzvier, I've been trying to create this functionality with MC but it isn't quite working for me.

    I would like to be able to have a "click to zoom" feature whereby if a particular key/button is being held down the camera will smoothly zoom in to a particular position at a specified speed, and when the key/button is released it smoothly returns to its original zoom position/distance. A good example of this kind of functionality can be seen in the bootcamp demo when the aim button (right mouse button) is pressed - the camera zooms in temporarily to a position above the gun until the button is released. As it turns out I would be most likely using this for the aiming of weapons also.

    Any suggestions about this?
     
  8. tzvier

    tzvier

    Joined:
    May 20, 2010
    Posts:
    355
    Hamesh, try this,

    MCKeyToZoom:

    Code (csharp):
    1. #pragma strict
    2. private var mc : MasterCamera;
    3. var zoomKey : String = "z";
    4. var zoomDistance : float = 0;
    5. private var returnDistance : float;
    6.  
    7. function Start(){
    8.     mc = GetComponent(MasterCamera);
    9. }
    10.  
    11. function Update () {
    12.     if (Input.GetKeyDown(zoomKey)) {
    13.             returnDistance = mc.preferredDistance ;
    14.     }  
    15.    
    16.     if (Input.GetKey(zoomKey)) {
    17.             mc.preferredDistance = zoomDistance;   
    18.     }  
    19.    
    20.     if (Input.GetKeyUp(zoomKey)) {
    21.         mc.preferredDistance = returnDistance; 
    22.     }
    23.  
    24. }
     
  9. rezilausiv

    rezilausiv

    Joined:
    Nov 18, 2010
    Posts:
    126
    Hi Master of the Camera

    Just for recommend:
    Can you provide a demo scene with a FPS modus (without a character).
    I need a camera walkthrough with fluid (adjustable damping) movement in all directions.
    >Moving mouse cursor for looking up/down, left/right. (Must work with the Webplayer in every Browser)
    >The arrows(and "w"/"s"/"a"/"d") for moving forward, backward, sideward and the space bar for jumping.

    I guess you already has such a demo in a previous version, but couldn't find anymore.

    Thanks for staying innovative

    Visualizer
     
  10. Hamesh81

    Hamesh81

    Joined:
    Mar 9, 2012
    Posts:
    405
    Thanks a lot tzvier, I will try this out and let you know how I go. How difficult would it be to add a speed variable to the zooming? Maybe a lerp could be used in a similar way to how the camera rotation returns to a preferred rotation?
     
  11. tzvier

    tzvier

    Joined:
    May 20, 2010
    Posts:
    355
    rezilausiv - MasterCamera doesn't deal with the character controller. However, if I understand correctly, I believe you can get an idea of what you are looking for by taking the the 3PS scene, adding MCMouseDampened to the MasterCameraRig, setting the MasterCamera.js > Preferred Distance to 0, and removing the MCScroll. Let me know if that is the style of camera you are looking for.


    I have released a new update (2.5.11) that include the MCKeyToZoom, and an alteration to MCScroll where:

    -"Speed" changed to "mouseSpeed"
    -"Scroll Speed" added to actual camera movement speed.
     
  12. Hamesh81

    Hamesh81

    Joined:
    Mar 9, 2012
    Posts:
    405
    Just tested it, works great, thanks a lot tzvier!

    I have a question about cameras and pausing, maybe you may be able to point me in the right direction. When the player gets a certain distance from an enemy I would like to be able to pause my game (for a specified time) BUT not pause my camera and have the camera turn towards the enemy. I've been looking at Time.timescale and using it for the "pause" functionality but I don't know how to pause everything except the camera. Would something like this be possible?
     
  13. daisySa

    daisySa

    Joined:
    Dec 29, 2011
    Posts:
    341
    I really like Master Camera but I have a question.

    I've selected MouseHorizontalAndVertical as the camera rotation mode. I'm using the W key to move forward, and the mouse pointer to turn. What parameter can I adjust to ensure that the mouse pointer mostly stays over the player character while rotating?

    I'm writing my game on a laptop with a trackpad, so I can't just pick up the mouse to reposition it after rotating, I have to rotate the camera (and then the character is facing the wrong way).

    Any help greatly appreciated!
     
  14. tzvier

    tzvier

    Joined:
    May 20, 2010
    Posts:
    355
    Hamesh, I honestly don't have any idea where to start to try to implement a pause feature.

    daisyDynamics, are you looking for something like Screen.lockCursor ?
     
  15. rezilausiv

    rezilausiv

    Joined:
    Nov 18, 2010
    Posts:
    126
    Hi Master of the Camera

    Your new version 2.5.11 is crashing with Untiy 3.5.7 under Mac OSX 10.6.8. by double clicking "3PSDemo". "FlightingDemo""RTSDemo" is ok.
    And whats about spending uns a FPSDemo too?

    Visualizer
     
  16. tzvier

    tzvier

    Joined:
    May 20, 2010
    Posts:
    355
    v5.2.11 is not compatible with Unity pre v4.
     
  17. rezilausiv

    rezilausiv

    Joined:
    Nov 18, 2010
    Posts:
    126
    Why this?

    However, is it possible for you to modify the MasterCamera with a FPS mode like this:
    >Arrows (and w,s,a,d buttons) steers the forward, backward, and sideward of the walkthrough
    >The mouse moves change the walk and view direction.
    >MCScroll changes the field of view of the camera (real zooming)

    This could be a truly ergonomic FPS interface. Please think about it.
     
  18. tzvier

    tzvier

    Joined:
    May 20, 2010
    Posts:
    355
    This has to do with the way the Asset Store works. The minimum version required by submitted assets is the version used to submit it.

    As I said before, MasterCamera does not handle character controlling. Perhaps what you are looking for can be found here
     
  19. rezilausiv

    rezilausiv

    Joined:
    Nov 18, 2010
    Posts:
    126
    No, it don't needs character controlling (by the way, you already have this in your 3PS Demo).

    What I am looking for is the same like your ThirdPersonDemo, but without a character at all, only a camera for smoothly walking through a virtual architecture.
    >Arrows (and w,s,a,d buttons) steers the forward, backward, and sideward of the walkthrough
    >The mouse moves change the walk and view direction.
    >MCScroll changes the field of view of the camera (real zooming)

    I made this once by my self: http://www.visualizer.ch/3ddemo.php
    But it needs your brilliant adds to be the best camera navigation for virtual reality in architecture.

    I guess for you it wouldn't be that heavy to modify your engine.

    Thanks to be open
    visualizer
     
  20. rezilausiv

    rezilausiv

    Joined:
    Nov 18, 2010
    Posts:
    126
    Hi

    When do you update your manual for the actual version of MasterCamera?
    For the MCScroll Script you new have a "Mouse Speed" and a "Scroll Speed" instead of "Speed" only. What's the difference?
     
  21. tzvier

    tzvier

    Joined:
    May 20, 2010
    Posts:
    355
    rezilausiv, That information can be found in the change log on the first page of this thread.


    Change Log:

    Update 2.5.11
    -MCScroll:
    --"Speed" changed to "mouseSpeed"
    --"Scroll Speed" added to effect actual camera movement speed.
    -MCKeyToZoom added - allows the camera to zoom on defined keypress.
     
  22. rezilausiv

    rezilausiv

    Joined:
    Nov 18, 2010
    Posts:
    126
    Hi

    Why "Smooth Rotation Location" has non effect at all. We strongly need adjustable damping for Rotation, Move and Zoom.
    An please implement also a real camera zoom by the MCScroll Script it should change the field of view of the camera.
    Guess this must be a common feature of a commercial Unity Asset with the name "MasterCamera"

    Thanks to think for your customers

    Visualizer
     
  23. tzvier

    tzvier

    Joined:
    May 20, 2010
    Posts:
    355
    Update

    2.5.12
    -Added MCFOVZoom for Field of View Zooming.



    rezilausiv - I assume you mean Smooth > Rotation and Location in the main MasterCamera.js script. Those variables are for the position and rotation of the whole camera rig. Smooth > Rotation has no effect in any of the Mouse Follow modes. I think what you want is MCMouseDampened.
     
  24. rezilausiv

    rezilausiv

    Joined:
    Nov 18, 2010
    Posts:
    126
    Hey Master of the Camera

    OK, for that damping effect you made a separat script, I see. The damping ("after swing effect") of MCMouseDampened is for my opinion a bit long. So I made a multiplikation of deltaTime with four like this: .... damp, Mathf.Infinity, Time.deltaTime*4); With that modification the look around is perfect smoothly.

    In the new release 2.5.12 lacks still a MCScrollFOVZoom.
     
    Last edited: Feb 13, 2013
  25. johnny12345

    johnny12345

    Joined:
    Oct 8, 2012
    Posts:
    45
    im after a topdown sidescroller camera,can this do that
     
  26. tzvier

    tzvier

    Joined:
    May 20, 2010
    Posts:
    355
    johnny - As I see it, top-down and side-scroller are two different things. Could you provide an example of a game that uses it?


    rezilausiv - Glad you were able to figure out the dampening. I'm not sure what you mean about MCScrollFOVZoom. The newest addon is MCFOVZoom, if that is what you are looking for.
     
  27. rezilausiv

    rezilausiv

    Joined:
    Nov 18, 2010
    Posts:
    126
    Hi Master of the Camera

    >About the FOV Zoom:
    I would like to have a Addon "MCScrollFOVZoom" Where you can set the FieldOfFiew of the Master Camera with the mouse wheel between a given range (like a zoom button of a real camera). Additional with an in and out key ("i" "o")

    >About the MCMouseDempened:
    I have found out a little issue here. Make for a test this setup: Bring a FirstPersonController Prefab from the Standard Asset in to the scene. Delete the MainCamera within the FirstPersonController object (and make the Graphics invisible too). Link the player of your MasterCamera Script to that game object now. Choose "MouseHorizontalAndVertical" of the "Camera Rotation Mode". Choose 0 of "Preferred Distance".
    Now if you play the scene you can see that you have a simple FPS camera walkthrough, but without damping/smoothess of the camera lookup. But the fact is, that the camera looks always in that direction where your FPS controller is "walking" through and the FPS object is walking where you are looking, all steered by the mouse x/y move.
    Next add the "MCMouseDampened" script to the MasterCameraRig. From now on, you can see that the look around is smoothly yes, but the FPS object is not following the direction of looking direction any more. It is drifting up more and more..

    Regards
    Roman
     
  28. Hamesh81

    Hamesh81

    Joined:
    Mar 9, 2012
    Posts:
    405
    I have an interesting camera question i've been wondering about. I know there are 1st and 3rd person cameras, but is there such a thing as a 2nd person camera in games? For some reason I thought that maybe 2nd person meant side scroller, but i'm not sure.
     
  29. tzvier

    tzvier

    Joined:
    May 20, 2010
    Posts:
    355
  30. Hamesh81

    Hamesh81

    Joined:
    Mar 9, 2012
    Posts:
    405
    Wow, that puts a huge cross through my theory then haha. I suppose side scrollers are also considered 3rd person perspective, thanks for that.

    Also, I have another suggestion to MC. I really liked the click to zoom that was added recently, but I was wondering if a small option could be added to at. I would like to be able to set a left or right offset to the camera's zoom position, because at the moment when I zoom the camera either stops right behind the characters head or flies straight through it. By adding the offset it would zoom forward and to an "over the shoulder" sort of position. I'm not sure if the easiest way would be to just combine this with the camera strafing movement, but I'll leave that up to you ;)

    Let me know your thoughts
     
    Last edited: Feb 20, 2013
  31. tzvier

    tzvier

    Joined:
    May 20, 2010
    Posts:
    355
    Hm, Do you have MCScroll > Mesh Hiding enabled? I would suggest playing with the distance there, and the MCFOVZoom > Camera Move Speed, so the mesh is hidden just before the camera would clip through it.

    You can still have the over the shoulder view with MCStrafe. Combining the two likely wouldn't be too difficult, but it might be a little messy and more suitable for an individual project, if that functionality were critical to that project.
     
  32. Hamesh81

    Hamesh81

    Joined:
    Mar 9, 2012
    Posts:
    405
    Sorry for the late reply, I began working another part in the meantime. I think what I'll do for this is simply set the camera zoom and strafe to be triggered by the same key (RMB). This way when aiming, the camera will zoom forward but to the side behind the shoulder as well. I'll post here when I complete this part.

    I have another interesting question, which relates to a "Cover System". I'm wondering whether I should approach the cover system from the camera side of things or the character animation side. At the moment I am using a follow behind MC, and so when my character goes to stand with their back or side to some cover the camera is of course positioned behind the cover and not facing perpendicularly towards it. So I'm wondering if I should rotate the camera so that it is facing perpendicular, or have the character simply rotate in place by animation instead of rotating at its transform.

    I've posted pics from 2 games to better illustrate the cover system I mean. Please let me know your thoughts.


     
  33. tzvier

    tzvier

    Joined:
    May 20, 2010
    Posts:
    355
    I would expect this to be completed via character animation. Trying to rotate the character transform and the camera rig at the same speed on opposite directions would likely be finicky at best. Usually there is a custom animation when the character presses themselves against the wall anyway, so adding the rotation there seems like the easiest solution.
     
  34. Hamesh81

    Hamesh81

    Joined:
    Mar 9, 2012
    Posts:
    405
    I thought as much, I think it will be the simplest solution. Thanks for the tip
     
  35. rezilausiv

    rezilausiv

    Joined:
    Nov 18, 2010
    Posts:
    126
    Problem with MasterCamera by exporting a project as an Android APP!
    This with MasterCamera 2 on Unity 3.5.7.

    By exporting the same project as standalone and as web player version not prompting any errors.

    Any suggestion why this happens?
     

    Attached Files:

  36. tzvier

    tzvier

    Joined:
    May 20, 2010
    Posts:
    355
    What version of MasterCamera are you using? Do the mentioned scripts contain "#pragma strict" at the top?
     
  37. merlinjan

    merlinjan

    Joined:
    Sep 19, 2012
    Posts:
    3
    I've just started on unity and are eager to learn more.
    No major problems with Mastercam in single player mode (running fantastic). Unfortunately I can not get Master cam to work in combination together with the photon Cloud server.
    I have encountered various problems. should I use MultiplayerTracker.js.
    by pure luck perhaps you can provide me with an example on how use Mastercam with Photon Pun Cloud
    I would greatly appreciate some help here.

    All the best!
    Jan. C
     
  38. tzvier

    tzvier

    Joined:
    May 20, 2010
    Posts:
    355
    Jan, I am fairly unfamiliar with networking programming in general, let alone cloud programming, never mind at all specific cloud, ehm, architectures? (if that's even the right word). What I can say is that I would expect the use of MasterCamera to be implemented entirely on the client side. If you want the clients' camera to track 1 target, use any of the normal MasterCamera setups. If you want the clients' camera to track multiple targets, use the MultiPlayerTracker.

    Let me know if that is at all helpful to you.
     
  39. rezilausiv

    rezilausiv

    Joined:
    Nov 18, 2010
    Posts:
    126
    Where can I check the version? How ever it is not the current one which by the way not runs under Unity 3.5.7...

    Yes it use the #pragma strict on the top.

    The errors occurs only if I switch the project from standalone to iOS or Android or if I build that project form out the standalone to iOS/Android.
     
  40. tzvier

    tzvier

    Joined:
    May 20, 2010
    Posts:
    355
    While you are set to Android, have you tried reimporting the MasterCamera package?
     
  41. rezilausiv

    rezilausiv

    Joined:
    Nov 18, 2010
    Posts:
    126
    Yes I do so now. First I create a new empty project under Unity 3.5.7 with Android as platform. Than I imported the Master Camera package 2 (older version which works under Unity 3.x standalone) into that project. After starting one of the demo scene it prompts all those errors, which you can see above.

    The current version 2.5.12 has the same problem but additional those demo scene are even not running correctly under UnityPro 3.5.7 standalone....

    So I have a real problem now with Master Camera to use it for Android mobile projects. Is it possible to fix that? Or can you make me a refund?

    Roman
     
  42. tzvier

    tzvier

    Joined:
    May 20, 2010
    Posts:
    355
    Well, it looks like it's just the Preset scripts, which you don't need in order to use MasterCamera, they just make it a little easier to setup specific types of cameras. So we have a few options.

    Either you can just delete those scripts and manually setup your cameras or we can get together over teamviewer and skype to investigate / resolve the specific issue.
     
  43. rezilausiv

    rezilausiv

    Joined:
    Nov 18, 2010
    Posts:
    126
    Hi tzvier

    But strange, am I realy the only here with that issue? You have tested Master Camera and all those demo scene for mobiles too, right. To finde the bug, we should find out now the difference between our platforms. I work with MacOS with Untiy 3.5.7

    About Preset: You mean removing all MC script components of the Master Camera rig by your demo scenes?
     
  44. tzvier

    tzvier

    Joined:
    May 20, 2010
    Posts:
    355
    I vaguely recall someone having a similar issue to yours with mobile quite a few months ago. The problem was fixed, and an update released, but maybe it got lost in the conversion for Unity 4.

    As far as the presets: What I mean is that you could delete the whole Presets folder, and you would be fine. It would not effect the, nor limit the functionality of the camera in any way. You would just have to manually set up what scripts and the variables on the rig.
     
  45. rezilausiv

    rezilausiv

    Joined:
    Nov 18, 2010
    Posts:
    126
    Sorry but I can not understand that steps however .. after deleting the MC Preset folder it prompts some new errors of not finding those scripts any more.

    Therefore the best now would be that you fix that on your site an please also for those who not have updated to Unity 4.x.
    MasterCamera should still working for them.

    Thank you very much

    PS: After this we can again talk about new features like implementing af FOV camera zoom with the scroll wheel?
     
  46. tzvier

    tzvier

    Joined:
    May 20, 2010
    Posts:
    355
    I will need to see what you have going on. This will require teamviewer and skype. Please PM me your skype name and we can take a look at the issues you are having.
     
  47. rezilausiv

    rezilausiv

    Joined:
    Nov 18, 2010
    Posts:
    126
    It is simple: By importing the MC package with Android or iOS as platform Unity prompts some errors (look above). Bevor a teamviewer session, you can prepare a proper package which don't make any problems. It is not that way I guess, that I am the only one with that problem, right?

    What I can do, is sending you my MasterCamera package which I am using with Untiy 3.5.7 direct to your personal email address. Should I do it that way?
     
  48. tzvier

    tzvier

    Joined:
    May 20, 2010
    Posts:
    355
    It is not as simple as "prepare a proper package which don't make any problems." Even from a new project and a fresh import of MasterCamera, there are a number of variables I cannot test. I do not have a mac, and I do not have Unity 3.5.7, let alone the Android or iOS plugins. If you would like my support on this issue, I need to see your specific setup.
     
    Last edited: Mar 22, 2013
  49. rezilausiv

    rezilausiv

    Joined:
    Nov 18, 2010
    Posts:
    126
    Yes I see your goodwill

    But there are non specific setups here! How comes that you don't have Untiy 3.x?

    Back to the error messages above: Do they telling you anything?
    And please to all others on that MC support forum which works on a Mac: Has anybody else that error messages by importing the Master Camera package into an iOS/Android platforms?

    Thanks to all for help improving this issue.
     
  50. tzvier

    tzvier

    Joined:
    May 20, 2010
    Posts:
    355
    I cannot devote any more time to discussing this rezilausiv. If you want my support with this, I need to see what is happening.