Search Unity

[RELEASED] Pro Camera 2D - The definitive 2D & 2.5D Unity camera plugin

Discussion in 'Assets and Asset Store' started by luispedrofonseca, Jul 29, 2015.

  1. flashframe

    flashframe

    Joined:
    Feb 10, 2015
    Posts:
    797
    That's awesome, thanks Luis! Quick work too. Will be in touch with the invoice number, thanks :)
     
  2. flashframe

    flashframe

    Joined:
    Feb 10, 2015
    Posts:
    797
    @archwaykitten
    You can do this by turning off the gizmos in your scene view. If you use the drop down you can turn off individual gizmos for different objects in your scene.
     
    luispedrofonseca likes this.
  3. Rodiaz89

    Rodiaz89

    Joined:
    Apr 11, 2014
    Posts:
    136
    Hola Luis!
    Thanks for all your efforts, this asset has been extremely useful :D

    I’m having an issue with resetting the camera when the player dies to the right position/zoom state.

    I can get the camera back to the initial position and even zoom but the issue is that the Speed Based Zoom component keeps the previous speed of the targets so after I reset the camera, the momentum that the camera had before, starts to apply even after the MoveCameraInstantlyToPosition is set, so it gives me a jolt either up or down if the player was previously going vertically in a different speed and respawns to the starting position.

    Would love to have a method on the ProCamera that would set the camera to the “final” position based on the assigned targets so when I move a target’s position, I can reset the camera, for example if my main player dies and respawns in the starting point I would call that method and it would automatically jump there based on the rest of the ProCamera values I assigned and have the Zoom speed momentum and other variables reset so it starts from zero.
     
  4. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    941
    @Rodiaz89 I can see what you're saying and your request makes total sense. I'll definitely solve it in the next update (1.6.2) but I need some time to think the best way to do it. Since it would involve resetting the "Core" and an "Extension" we need a clean way to do it.
    I'll keep you posted on this, but rest assured it will be taken care soon!
     
    Rodiaz89 likes this.
  5. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    941
    @tinkergames I've included a fix to your issue in the v1.6.1.

    This version was just submitted to the store but it might take a few days to get approved. If you want to get it sooner, please send me your invoice number and I'll send you an updated package.

    Here are the updates for v1.6.1:

    • The camera is only parented if using the Shake extension
    • Fixed an issue where deleting Cinematic camera targets could throw an (harmless) error to the console
    • When using the Cinematics extension, if a target has a Hold Duration less than 0, the camera will follow it indefinitely
    • Added a method (GoToNextTarget) to the Cinematics extension that allows you to skip the current target
    • Prevent the Game Viewport size on the Pixel Perfect extension to go below (1, 1)
    • Fixed a bug where the TriggerBoundaries would have a missing reference if instantiated manually
     
  6. Rodiaz89

    Rodiaz89

    Joined:
    Apr 11, 2014
    Posts:
    136
    Awesomeness! Yeah I know how it is, I'm one of the owners of Gamestrap UI and you have to make sure it all works well. Really good job on the asset, I rarely buy assets and this one turned out even better than I expected!
    We were looking for a Camera asset and you just happened to be on sale as well, lucky us :p
     
    luispedrofonseca likes this.
  7. Shadeless

    Shadeless

    Joined:
    Jul 22, 2013
    Posts:
    136
    Hey, so I finally got the asset and got some time to tinker with it, and I must admit, I'm having difficulties configuring the pixel perfect settings properly... It's easy to get it to be pixel perfect with 1 resolution and it's proper multiple, but when you try other resolutions it's not on the same zoom level and on some resolutions it's not pixel perfect. So I must have not grasped everything properly.

    Can I get a rundown of exactly what I need to do to configure everything properly?

    Cheers
     
  8. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    941
  9. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    941
    @Rodiaz89 Just to let you know that unfortunately I haven't had the time yet to add your feature request but I'll handle it as soon as possible. This means that it won't make the cut into 1.6.2 but it will be part of the next one.
     
  10. Yukichu

    Yukichu

    Joined:
    Apr 2, 2013
    Posts:
    420
    Alright, so I purchased this asset and I can definitely see where it shines, but... urgh....

    It creates its own object and has it destroyed when you switch scenes. I get it and I could try to make it not destroy between scenes, but after one failure I just gave up as I didn't think it was going to do what I needed anyhow. Suggestion to add an option to keep the camera between scenes.

    I was thinking, oh 2.5D that's me that's me! But I guess I do 2.5D in a different way. It's not overlapping layers, my sprites are standing up (90 degrees) and the camera is a 45 degree angle. The most annoying thing I had to do with my camera was rotate it around the character (since it's actually a 3D scene) and so perhaps I'm more 3D-wishing-I-was-2.5D.

    Great tool for 2D. Very sad I bought it and can't use it for what I need. Maybe later for something else.
     
  11. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    941
    @Yukichu Thanks for purchasing ProCamera2D!

    In regards to the camera being automatically parented, this behaviour was fixed in version 1.6.1 (released a few hours ago). Now the camera is only parented if you're using the Shake extension. If you intend to keep the camera between scenes you basically just have to do it like you would on any other normal Unity GameObject.

    As for 2.5D, not sure what you mean with overlapping layers (maybe parallax?) but my understanding of it is when a game despite being in 2D, the camera is in 3D (perspective).

    I'm sorry to hear ProCamera2D won't fit your current needs, but hopefully you'll be able to use it in a future project.

    Cheers!
     
  12. Rodiaz89

    Rodiaz89

    Joined:
    Apr 11, 2014
    Posts:
    136
    No worries, we still have a couple of months before publishing the game so we are good!
     
    luispedrofonseca likes this.
  13. Mr-Stein

    Mr-Stein

    Joined:
    Dec 4, 2013
    Posts:
    169
    I really need the same feature that @Rodiaz89 need.. :/
     
  14. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    941
    @Mr.Stein No worries. It should be ready in the next few days. As soon as it's ready I'll send you both emails with the updated package so you don't have to wait for it to be approved.
     
    Rodiaz89 and Mr-Stein like this.
  15. Mr-Stein

    Mr-Stein

    Joined:
    Dec 4, 2013
    Posts:
    169
  16. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    941
    @Mr.Stein @Rodiaz89 I've added a new method - Reset - which, like the name says, resets the camera and its extensions to their initial values and also instantly moves to the targets position. If a false is passed, the camera will reset but it won't move to a new position.

    If you'd like to test this, please send me your invoice number and I'll send you an updated package. Thanks!

    P.S.: This is something very useful that was clearly missing from the Core API so thanks for the suggestion! ;)
     
    Rodiaz89 likes this.
  17. Mr-Stein

    Mr-Stein

    Joined:
    Dec 4, 2013
    Posts:
    169
  18. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    941
    @Mr.Stein via email would be easier but PM works too.
     
  19. jwvanderbeck

    jwvanderbeck

    Joined:
    Dec 4, 2014
    Posts:
    825
    Hi there,

    Just found this thread so maybe easier than using the support email, but not sure?

    Anyway I seem to have run into another bug. The Zoom trigger doesn't appear to work correctly with a perspective camera. It zooms by physically moving the camera, which is actually fine for me (though an option to move OR change FOV would be cool), but the problem is it never "settles" in to the proper position. It moves in, gets real close (like within 0.001 or so) and then snaps back out a few units then goes in again, repeating over and over.

    It appears to operate fine on an orthographic camera, where it just changes the size instead of moving the camera.
     
  20. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    941
    @jwvanderbeck Thanks for the bug report.

    The zooming happens by moving the camera instead of changing the FOV because it's the correct way of zooming when using a perspective camera. In an earlier version it was done by changing the FOV but that made things look distorted. I guess I could have an option to choose the method so I'm going to give it some thought.

    Regarding the approximation error you're getting, I'll take a look and I'll get back to you as soon as possible.

    Cheers!
     
  21. jwvanderbeck

    jwvanderbeck

    Joined:
    Dec 4, 2014
    Posts:
    825
    Well technically the "correct" way of zooming is to change the focal length, which in Unity is a FOV change. That is technically a Zoom. Sure it may cause distortion but that is how a camera works :)

    What you are currently doing is what is more often called a Dolly, where you physically move the camera to get closer to a subject but retain the same focal length.

    You can also, in cinematography, do both at the same time which is known as a Dolly Zoom and it produces a rather distinctive effect which you may have seen in films. Typically you do them in opposition to each other so you would say zoom out while dollying in, or the other way. By doing this you can keep the subject the same relative size while changing the field of view.


    Just some food for thought it you want to expand your camera's abilities :)

    Anyway as for my bug, I am using the XZ axis but it appears to have the same issue in XY as well.
     
  22. jwvanderbeck

    jwvanderbeck

    Joined:
    Dec 4, 2014
    Posts:
    825
    Ok so some more information from my own debugging of the issue.

    First off, the error is different depending on whether I have "Set size as multiplier" set.

    If it is NOT set, then my debugging shows that each time the coroutine is run, ProCamera2D determines a slightly different target, but never actually settles on one, this leaves the camera constantly moving all over and the actual camera position never reaches the calculated one (because the calculated one is constantly shifting) and thus the zoom wobbles and never ends.

    If it is IS set, the each run of the coroutine properly calculates the SAME value and everything works properly with no camera wobble. The bug I was seeing where the camera pops back a bit then zooms again seems to be caused by this piece of code:

    // If the camera is bounded, reset the easing
    if (_previousCamSize == ProCamera2D.ScreenSizeInWorldCoordinates.y)
    {
    _targetCamSize = ProCamera2D.GameCameraSize;
    _targetCamSizeSmoothed = _targetCamSize;
    _zoomVelocity = 0f;
    }

    So in that case it may be a setting issue? I am not sure what it meant by ":If the camera is bounded" but that is exactly what is happening. Before the camera reaches the target position, it hits this code and bounces back and them tries to move down again, constantly looping over and over.
     
    luispedrofonseca likes this.
  23. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    941
    @jwvanderbeck Thanks for the clarification regarding the zoom. Learnt a new thing today! :)

    Regarding the bug (thanks for digging in) you're experiencing I'm going to have a look tomorrow and get back to you as soon as possible. I know what might be happening and shouldn't be hard to fix.

    Cheers!
     
  24. bigSky

    bigSky

    Joined:
    Jan 31, 2011
    Posts:
    114
    Hi - What a great asset. I have what is perhaps a bug when exiting full screen playmode while using a procamera with mouse follow extension on a UI canvas. Always seems to hang unity on a re-paint. MacOS10.10.5.
     
  25. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    941
    @bigSky Thanks! Can you please explain further or provide me a sample project that replicates the issue?
     
  26. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    941
    @jwvanderbeck I've fixed the issue you reported with the Trigger Zoom and I've also added the option to zoom by changing the FOV instead of actually moving the camera.
    Please send me your invoice number if you'd like to access an updated package so you don't have to wait until it's approved by the Asset Store.
     
  27. bigSky

    bigSky

    Joined:
    Jan 31, 2011
    Posts:
    114
    Hi Luis,
    Well - to set it up, all you have to do is to make a UI panel, make a ProCameraCamera (by dropping prefab), make canvas World space, add a pointer move extension, toggle "maximize on Play" in the game tab, then noodle about for a bit, then hit stop - then it hangs.
    Now, I wouldn't be surprised if this is from my side - or Unity's - I'm pretty impressed by ProCamera so far (though I do have some suggestions ;)) so I'm not really expecting it to be your bug - but nevertheless, it's pretty a reliable hang.
     
  28. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    941
    @bigSky I can't replicate that error. Does it happen also if you do it on the included "Examples -> Pointer Influence" scene?
    What Unity version are you using?
     
  29. bigSky

    bigSky

    Joined:
    Jan 31, 2011
    Posts:
    114
    Hi Luis - If I add a UI Panel to the pointer influence scene, and make the canvas world space, then, yes, it does hang or Unity crashes. I'm using 5.2.0f3. It does not happen with Overlay mode.
     
  30. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    941
    @bigSky I believe that's crashing in your case, but I really don't see why it would have anything to do with ProCamera2D. ProCamera2D doesn't mess with UI in any way and it really shouldn't affect it.
    Here's a video of how it's working in my case: https://dl.dropboxusercontent.com/u/883485/ProCamera2D/pointer_influence_bug_test.mp4

    I'm using OSX 10.11.1 and Unity 5.2.2f. Maybe you could update to the latest OSX and Unity?

    If someone else could try this out would be great.
     
  31. bigSky

    bigSky

    Joined:
    Jan 31, 2011
    Posts:
    114
    Hi Luis - New unity update did the trick. Thanks for your patience.
     
    luispedrofonseca likes this.
  32. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    941
    Hi guys, just wanted to show you a sneak peek of the new extension coming in v1.7.0 - The Rails extension.
    It allows you to define a path that the camera will follow based on your targets position. It's AWESOME for those situations where you want that extra control over your camera position but still allow the player to move it.

    Here's a quick video:
    https://twitter.com/lpfonseca/status/667413955250360320
     
    Mr-Stein and flashframe like this.
  33. Manny Calavera

    Manny Calavera

    Joined:
    Oct 19, 2011
    Posts:
    205
    Great addition. In fact, that's exactly how my custom camera works right now. Here are some of the things I've done with my camera rail you might consider useful:

    - Each node has certain 'override' settings that are interpolated between the two closest nodes. For instance, Zoom. I can assign a zoom of 4 in one node and 3 on the next and as the character walks by these nodes the camera zooms in/out accordingly.
    - I can also 'hang' certain events and callbacks on my rail that are triggered as the camera goes by. For instance, I can activate/deactivate objects based on where the camera is along the rail giving me great control over culling. Another example is foreground parallax objects which I interpolate in between two nodes of the rail.
     
    luispedrofonseca likes this.
  34. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    941
    @Manny Calavera Thanks for the suggestions!
    You can actually already accomplish that. Since, like the others, you can combine the Rails extension with any other extension / trigger.
    I actually don't have a trigger to activate/deactivate objects as part of the package because I don't think it's a common use, but that's super easy to do using the provided API.

    Please keep those suggestions coming! ;)
     
  35. DoctorShinobi

    DoctorShinobi

    Joined:
    Oct 5, 2012
    Posts:
    219
    Hey @luispedrofonseca , I assume you're the developer right?
    First thing, I want to say thanks for creating this plugin. saved me a TON of time creating a 2D camera, and now I can use this time to work on my game instead.

    second of all, I want to report a bug. The geometry boundaries extension doesn't work with boundaries created at runtime. I assume it only registers boundaries on awake\start?
     
  36. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    941
    @DoctorShinobi Yes, I'm the developer. :)
    The geometry boundaries work independently if they are created at runtime or not. As long as they're on the correct layer and at depth 0 (Z = 0 if you're on XY axis), everything should work just fine.
     
  37. DoctorShinobi

    DoctorShinobi

    Joined:
    Oct 5, 2012
    Posts:
    219
    Will try that, thanks.
     
    luispedrofonseca likes this.
  38. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    941
    flashframe likes this.
  39. Mr-Stein

    Mr-Stein

    Joined:
    Dec 4, 2013
    Posts:
    169
    Hi @luispedrofonseca, I have some problem when I try to run the example scene "TopDownShooter", well when I open the scene I an error "NavMesh asset format has changed. Please rebake the NavMesh data.".
    And when I try to run the TopDownShooter scene then my Unity stop working.
    This is happening to me in Unity 5.2.1f1 and 5.1.3f1
     
  40. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    941
    Hi @Mr.Stein, I've had people complain of that issue before. I'm not exactly sure what it is, but it seems the navmesh data gets corrupted somehow.
    To fix it, with the TopDownShooter scene open, go to Window > Navigation. Then, click the "Bake" button on the bottom-right corner.
     
  41. Mr-Stein

    Mr-Stein

    Joined:
    Dec 4, 2013
    Posts:
    169
    luispedrofonseca likes this.
  42. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    941
    Async0x42 likes this.
  43. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    941
    Async0x42 likes this.
  44. garrot

    garrot

    Joined:
    Dec 20, 2013
    Posts:
    8
    great asset @luispedrofonseca

    i have the same problem with trigger boundaries, like @AlbertStr. It's overwrite my default camera boundaries when i exit the trigger.
    Maybe its a good solution :)

    Thanks!
     
  45. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    941
    Hi @garrot, not sure I understood exactly your issue. Can you please be more specific or if possible, share a project that replicates the problem?
     
  46. Async0x42

    Async0x42

    Joined:
    Mar 3, 2015
    Posts:
    104
    Is there any way for ProCamera2D to detect user-made extensions, without having to manually modify the ProCamera2DEditor file? I don't know if it's possible, but if so that'd make it really sleek for user extensions (sharing etc, since people could just import them, and it'll show in the enable plugins menu)

    Edit: And if not, then maybe there's a more extensible way to modify that menu, perhaps in another source file, to avoid manually merging the editor script anytime ProCamera gets updated
     
  47. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    941
    Hi @Async0x42, currently the extensions and triggers that appear on the editor are still manually added.
    I am, however, planning to solve that very soon! :) I'll keep you posted!
     
  48. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    941
    Great news! The extensions and triggers section of the editor are now dynamically populated.
    This allows you to easily see your own custom extensions/triggers and also for users to share their own code. I'm planning to create a GitHub repo to handle all that soon.

    To make sure your extension/trigger appears on the menu all you have to do is add this to your class:
    Code (CSharp):
    1. public static string ExtensionName = "!!! My Custom Extension";
    2. // OR
    3. public static string TriggerName = "!!! My Custom Trigger";
    Screenshot 2015-12-15 11.37.40.png

    [EDIT]
    P.S.: This is coming in v1.7.4. Currently v1.7.3 is still in review so it might take a few days for this to go live. As always, if you want to get access earlier just email me your invoice number.
     
    Async0x42, flashframe and BTStone like this.
  49. BTStone

    BTStone

    Joined:
    Mar 10, 2012
    Posts:
    1,422
    This is very cool!
     
  50. BharatThreye

    BharatThreye

    Joined:
    Sep 23, 2014
    Posts:
    1
    So when using the NUMERIC BOUNDS, the camera instantly snaps to the nearest bound when it reaches it. Is there a way to smoothly do this stopping of the camera when using bounds (The camera should lerp to the bound position or even overshoot the bound a lil bit and then come back) ?
    Thanks.