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. BrothaMan

    BrothaMan

    Joined:
    May 19, 2013
    Posts:
    47
    Nice @luispedrofonseca ,

    Curious if you think the triggering for when the camera shifts from one room another can wait for multiple cameraTargets to reach that trigger position? The example I'm thinking is a local Co-op game, waiting for multiple players to enter a gate to shift to another room.
     
  2. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    829
    @BrothaMan

    By default the extension uses the ProCamera2D targets as the "detection point". i.e. if you have one target, once it enters a room it will transition to that room. If you have multiple targets, it uses their mid-point to activate the rooms.

    In the example you described, you can set the "AutomaticRoomActivation" to false, and then use the method " GetCurrentRoom(Vector3 targetPos)" for each of your players. If all of them are on the same room, you then call "EnterRoom(int roomID)".

    Would that suit you?
     
  3. joe_ftg

    joe_ftg

    Joined:
    Nov 9, 2015
    Posts:
    39
    No problem! I actually ended up changing the speed based zoom so it used the camera target's velocity rather the camera velocity. This worked much better for my case as I also use forward focus (without maintain-influence-on-stop). So before when the player stopped moving, the forward focus would add velocity until the player was centred, which would slow down the camera zooming back in. Absolutely correct, but didn't feel natural in my case!

    Might be useful to have a toggle for this, if it's within the project scope? I only had to deal with one target though (the player). If I'd had multiple I'd probably want it to use the maximum out of any player target, but ignore the velocity of non-player targets.
     
  4. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    829
    @joe_ftg That would probably make more sense in most cases actually. I'll add an option for it in a future release. Thanks! ;)
     
  5. Diet-Chugg

    Diet-Chugg

    Joined:
    Jul 4, 2012
    Posts:
    51
    The new Rooms extension looks fantastic! I haven't updated ProCamera in awhile now. I can't wait to give it a roll tonight. :)
     
    luispedrofonseca likes this.
  6. Kiupe

    Kiupe

    Joined:
    Feb 1, 2013
    Posts:
    528
    Hi,

    I just noticed that when using the Cinematics plugin the camera seems to not be constraint by the Numeric boundaries anymore. Would it be possible to decide if whether or not the camera should still be constraint by the numeric boundaries ?
    The point is to prevent the camera to show forbidden areas, like areas under the ground where there is nothing, when traveling to a target put on the ground.

    Thanks
     
  7. Kiupe

    Kiupe

    Joined:
    Feb 1, 2013
    Posts:
    528
    I have a question about the Room Extension. Would it be possible to have a default configuration, like Camera size and numeric Boundaries and having those configuration set back when leaving a room ?

    When watching your video I can see that the camera won't show the room 1 area until the player enters inside it. I'd like the camera to not be constrains (except by the global numeric boundaries) until the player enters a room. So when the player comes closer to the room, but it's not already inside it, the camera should show a part of the room. When entering the room the camera should behave as shown in the video, and when exiting the room the camera should get back to the global numeric and zoom boundaries.

    Does that make sense ? It's kind of like in your video but without the Room 0 - so the player it's not always in a room.

    Thanks
     
  8. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    829
    @Kiupe The Cinematics extension respects the Numeric Boundaries only if you have the "Use Numeric Boundaries" option checked.

    With the Rooms extension you always have a default configuration that is the one that starts the level (i.e. before entering any room). To restore to those settings once you leave a room you just have to enable the option "Restore on room exit".

    Also, remember you can have nested rooms. i.e. you can always have a larger room that contains your smaller ones. Just make sure the larger room has a lower index number (you can reorder them on the editor list).
     
  9. Kiupe

    Kiupe

    Joined:
    Feb 1, 2013
    Posts:
    528
    Thanks for the answers !

    Can't wait to test this new extension :)
     
  10. Kiupe

    Kiupe

    Joined:
    Feb 1, 2013
    Posts:
    528
    Ok, I just made a quick test and it's great ! I notice that the plugin gets the original numeric boundaries in the Awake method and it does not quite fit my needs because I programmatically regularly update those boundaries during the game - so I add a line a code in the EnterRoom method in order to get the current boundaries : _originalNumericBoundariesSettings = _numericBoundaries.Settings;

    Thanks for the great work !!!
     
  11. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    829
    @Kiupe Thanks! I'll add a method to do that so you don't have to change the original source code and don't have to worry about future updates.
     
  12. Kiupe

    Kiupe

    Joined:
    Feb 1, 2013
    Posts:
    528
  13. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    829
    Bagnol likes this.
  14. Kiupe

    Kiupe

    Joined:
    Feb 1, 2013
    Posts:
    528
    Hi,

    Would it be possible to have 4 events per room instead of two ? It would be useful to know when the target enter the room, when entering room transition is done, when the target exit the room and when exit room transition is done.

    Does that make sense for you ? To be honest, it makes for me ;-)

    Thanks
     
  15. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    829
    @Kiupe Can you please share your use-case? I don't see where it could be useful.
     
  16. Kiupe

    Kiupe

    Joined:
    Feb 1, 2013
    Posts:
    528
    Hi,

    For example, want to disable my character movement as soon as it enters a room but I want to start an animation when the room transition is finished. So both cases are relater to entering a room but need to be executed at different moment.

    BTH, I noticed something really annoying, when you delete a room, the numbers of the other rooms are updated. So if I have 5 rooms : 0,1,2,3,4 and then delete the room 2, I now have : 0,1,2,3.

    It's not really convenient because the only variable I can rely on to detect if the character enters/exits a specific room is the room number. So I have to reference room numbers on several scripts or maybe there is another way ? But if it's not the case, whenever I delete a scene, because that part of my level doesn't suit me anymore or whatever, all room number already referenced in script will be wrong.

    In the example I wrote, the script that listen the room 3 will now reference the room 4.

    One thing that could be useful, it's room having behaviour like TriggerNumericBoundaries - something like a script that allow to create a room - but the room affected to a sepcific GO and not set-up directly on the ProCamera2D GO.

    Does that make sense ?

    Thanks
     
    Last edited: Oct 6, 2016
  17. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    829
    @Kiupe,

    In the case you described you'd still only need the "OnStartedTransition" and the "OnFinishedTransition".

    Regarding the room numbers, that is right. Room numbers are assigned according to their position on the list (remember you can order them manually on the list). I could add another "id" that could be assigned manually. Can I ask why you're deleting rooms at run-time?

    The idea of having a helper class that allows to create individual rooms is good, but I'll need some more time to think how to implement it together with the extension.
     
  18. Kiupe

    Kiupe

    Joined:
    Feb 1, 2013
    Posts:
    528
    Ok, that's great. I have re-read the code, and I didn't noticed that OnFinishedTranstion was about ending the enter room transition. Actually, it's seems that there is no event about leaving a room.

    Question, if I have a small room and "restore on room on exist" is set to false, is it possible to know when I leave the small room ?

    So far I wasn't deleting room at runtime, but directly in the editor. During our level design process, sometimes you change your mind and delete a room - so all scripts already referencing a room number became wrong.

    But to be honest I plan to delete/deactivate room at runtime. Many rooms are used to create a focus on a specific area that contains a puzzle. The player can enters in and out freely and every time it enters inside the room is activated. But once the puzzle is solved I don't want the room to be active anymore, I don't need a focus in this area anymore. Does that make sense for you and answered your question ?

    Great :)

    Thanks a lot.
     
  19. KWaldt

    KWaldt

    Joined:
    Nov 1, 2013
    Posts:
    122
    Hello there!

    I bought Pro Camera 2D today, and I'm loving it so far! The interface is really nice and user-friendly, good work there!
    I'm having a question--is it somehow possible to use Forward Focus and Camera Window together?
    What I'm wanting to do is something similar to Mario:

    [From 0.33, or this link.]
    Basically, Forward Focus is used, but only if the player is moving outside of the Camera Window. (Something like a safe zone.)
    Right now, it doesn't work since Forward Focus moves the whole camera, and with it the Camera Window.
    upload_2016-10-7_23-52-9.png
    I guess using progressive would help a bit with the jumping, but I think just snapping to the right focus fits my game better.
    Is there a way to have them work together, or do I have to write a custom trigger or something?

    Have a nice evening!
    - Kristina Waldt
     
  20. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    829
    @Kiupe I'll add events about leaving a room and also a "custom ID" you can use instead of the auto-assigned ID's based on their list position.

    @KWaldt Thanks for buying ProCamera2D!
    The reason the CameraWindow and ForwardFocus extensions don't work well together is that they basically try to achieve opposite effects. With the CameraWindow you can move freely inside a rectangle without affecting the camera (i.e. you could potentially reach the camera borders without moving it). The Forward Focus moves you away from a camera border as you try to reach it. You can still use them together if the CameraWindow is large enough to cover the ForwardFocus borders, but it won't give you a very nice result.

    To achieve that exact same result as in the Mario video, you should use the CameraWindow and write a custom extension that changes the Offset (on the core class) as you move. Let me know if you need some directions with that.
     
  21. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    829
    Hey guys, Pro Camera 2D has been selected for this year's Unity Awards! Thank you so much for all your support and help in making this asset.

    If you'd like to cast your vote, please do it here: Unity Awards 2016

    I'll be in Unite LA with a booth to share the word about ProCamera2D. Come say hi if you see me! :)
     
    rrahim likes this.
  22. KWaldt

    KWaldt

    Joined:
    Nov 1, 2013
    Posts:
    122
    Yeah, I understand. My first thought was "hm, that doesn't work... actually, that makes sense".
    A few pointers would be nice, yes.
    Basically, I would write something that checks if the player leaves the window, and if he is, I'll smoothly move the camera to the new direction (gained from the camera window [or is there no way to check which side was left?]) using the predefined offset and speed. Is that right, or how would you go on about it? Can I do this in a separate script so all of this stays intact when updating the asset in the future?

    Thank you for the fast response!
    - KW
     
  23. flashframe

    flashframe

    Joined:
    Feb 10, 2015
    Posts:
    399
    Congrats man! Thoroughly deserved!
     
    luispedrofonseca likes this.
  24. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    829
    @KWaldt The easiest way would be to replicate the current CameraWindow script, creating your own extension and doing any changes as needed. Just make sure you change the name of the variable on the top too ("ExtensionName") so you can see it on the ProCamera2D's extensions list.
    This way you get full access to anything you need and don't need to worry about future updates.
     
    KWaldt likes this.
  25. Kiupe

    Kiupe

    Joined:
    Feb 1, 2013
    Posts:
    528
    Hi, any idea/estimation date about custom ID ?

    Thanks

    ps: congrats for the Unity Award selection !
     
  26. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    829
    @Kiupe Thanks! Working on it at the moment! Adding a few more things to the next release as well.
     
  27. KWaldt

    KWaldt

    Joined:
    Nov 1, 2013
    Posts:
    122
    Hey there again!

    Edit: Solved. Apparently using Supersampling and this asset together has weird results. Which I can just deactivate, so it's fine.

    Question--is it possible that your asset messes up the Gizmo view? It works fine if I deactivate it, but if it's active, the collider is displayed at the wrong place.
    upload_2016-10-13_20-17-11.png
    It's not a big deal since I can just deactivate the asset when debugging, but it's a bit annoying nevertheless.

    - KW
     
    luispedrofonseca likes this.
  28. Zehru

    Zehru

    Joined:
    Jun 19, 2015
    Posts:
    84
    Hello!
    I'm using the new room extension and I think it's really useful and nice :)

    I just would like to know if there is a way of activating and deactivating a certain amount of rooms at runtime.
    I'm creating a huge 2d exploration platformer game a.k.a metroidvania, and as the game is really huge, It would be better if I just activate a certain amount of rooms close to the current one that the player is inside.
    The game is still in development, but I guess that, it will have about 100 rooms or more.

    thank you for always giving a very nice support by email and also for the amazing asset!

    idea: maybe the rooms extension could be connected with a gameobject with a trigger. When you enter/pass this trigger, you will activate the rooms( based on IDs or room numbers) that were connected with that gameObject-trigger.
    well, that's just an idea( maybe a crazy one ^^)

    thank you and sorry for bothering :)
     
  29. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    829
    @KWaldt Thanks for the report and update! I'll see if I can do something about that, but I doubt it. Seems like a rendering bug introduced by the Supersampling.

    @Zehru Thanks! A large number of rooms shouldn't noticeably affect the performance. What you can do is to reduce the Update Interval from the default .1 to something larger that still works with your gameplay.
    Any how, you can always add and remove rooms programmatically by accessing the "Rooms" property on the extension. It's simply a List<Room>, so you can handle it however you see fit.
    Let me know if that works for you!
     
    Zehru likes this.
  30. Kirbychwan

    Kirbychwan

    Joined:
    Aug 14, 2012
    Posts:
    430
    @luispedrofonseca


    Hi! Your asset looks awesome, but I have a quick question:

    For one of my projects, we're currently locked in at Unity version 5.3.5 (for now); but the Asset store says it requires Unity 5.4.1 or higher.

    If I purchase it from the asset store, would it be possible to download older versions of the Camera that would be compatible with 5.3.5?

    Thanks!
     
    Last edited: Oct 14, 2016
  31. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    829
    @Kirbychwan Thanks for your interest in ProCamera2D! ProCamera2D works on all Unity versions from 4.6 and up.
     
  32. Kirbychwan

    Kirbychwan

    Joined:
    Aug 14, 2012
    Posts:
    430
    Thanks Luís for confirming; grabbing it now. :)
     
    luispedrofonseca likes this.
  33. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    829
    Just submitted a new version (2.2.1) that contains the following updates:

    - Core - Greatly improved rendering performance of the editor
    - PanAndZoom - Fixed an issue that prevented zooming after toggling the component
    - Rooms - Added an ID property that can be used to identify each room
    - Rooms - OnStartedTransition and OnFinishedTransition now send the previous room too
    - Rooms - Editor tweaks

    Like always if you'd like to have early access, get in touch!
     
  34. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    829
    Bagnol likes this.
  35. Bagnol

    Bagnol

    Joined:
    Sep 5, 2013
    Posts:
    103
  36. eddOrnelas

    eddOrnelas

    Joined:
    Jul 20, 2013
    Posts:
    9
    I have a camera rotated by 90 degrees, but when i activate a shake method the camera resets back to 0 degrees, how i can prevent that or fix that?

    regards
     
  37. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    829
  38. Kiupe

    Kiupe

    Joined:
    Feb 1, 2013
    Posts:
    528
    Hi,

    Would it be possible to have access to the submitted release before it get accepted ? I really need the custom room id in my current game, so if would be nice to get it asap :)

    Thanks
     
  39. Kiupe

    Kiupe

    Joined:
    Feb 1, 2013
    Posts:
    528
    I still have the issue, is that normal ?

    Would it be possible to have event when a room is exited ?

    Thanks !
     
    Last edited: Oct 19, 2016
  40. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    829
    @Kiupe That method is not implemented yet, but will come next version (2.2.2).

    The "OnStartedTransition" and " OnFinishedTransition" events send the room that was entered and the room that was exited.
     
  41. Kiupe

    Kiupe

    Joined:
    Feb 1, 2013
    Posts:
    528
    The OnExit method set _currentRoomIndex to -1 so I added the following line in order to know which room was left :
    _previousRoomIndex = _currentRoomIndex;

    Does that make sense ?
     
  42. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    829
    @Kiupe Not sure what you mean. The _previousRoomIndex is only set to -1 when the level starts or you exit all rooms.

    You should have a script like this:
    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3.  
    4. public class RoomsExample : MonoBehaviour
    5. {
    6.     public void StartedRoomTransition(int currentRoom, int previousRoom)
    7.     {
    8.         Debug.LogFormat("Started Room Transition - Current Room:{0} - Previous Room:{1}", currentRoom, previousRoom);
    9.     }
    10.  
    11.     public void FinishedRoomTransition(int currentRoom, int previousRoom)
    12.     {
    13.         Debug.LogFormat("Finished Room Transition - Current Room:{0} - Previous Room:{1}", currentRoom, previousRoom);
    14.     }
    15. }
    16.  
    And then add that script to the events on the Rooms editor, calling the appropriate methods. You'll then get something like this on your console:
    Let me know if this was clear.
     
  43. Kiupe

    Kiupe

    Joined:
    Feb 1, 2013
    Posts:
    528
    Hi,

    I was talking to _currentRoomIndex and not _previousRoomIndex.

    I made a test, I have one room which is Room 0 - the same debug as you wrote show :

    When entering the room :
    Started Room Transition - Current Room:0 - Previous Room:-1
    Finished Room Transition - Current Room:0 - Previous Room:0

    When exiting the room :
    Finished Room Transition - Current Room:-1 - Previous Room:-1

    So when leaving a room, currentRoom and previousRoom are equal to -1.

    btw : OnFinishedTransition is triggered when entering room transition is over and when the leaving room transition is over - so it's not really clear what this event is for because it is used for both entering and exiting a room.
     
  44. eddOrnelas

    eddOrnelas

    Joined:
    Jul 20, 2013
    Posts:
    9
    But i rotating mi camera 90 degrees on Z axis, so i still playing on XY axis
    This is for a game object who is "walking" on wall.
    So the objects rotates 90 degrees on Z and then the camera rotates 90 degrees on Z to match the object
    After activating shake method, the camera resets the Z rotation of the camera to 0
     
  45. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    829
    @Kiupe I think you are making some confusion with event names. The "OnStartedTransition" and "OnFinishedTransition" should output the same values of current and previous. The only difference between them is when they're fired.

    Any how, there were a few inconsistencies with when they should fire, that I fixed and will be part of the next update (v2.2.2).
     
  46. Kiupe

    Kiupe

    Joined:
    Feb 1, 2013
    Posts:
    528
    @luispedrofonseca They should fired the same values, ok, but as you can see it's not the case. The first two debugs are fired when I enter inside the room 0 and the last one when I left the room 0. I did nothing special, just added the event like you said with the same debug.Log().

    So when I enter the room OnStartedTransition and OnFinishedTransition did not fire the same values.
    When I exit the room both value are equal to -1 so no idea which room has been left.

    What can I possibly did wrong - any idea ?

    Thanks
     
  47. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    829
    @Kiupe Yes, there was a bug where they could not fire the same values. I've fixed it for the next release. (See your private messages for an updated build).
     
  48. eddOrnelas

    eddOrnelas

    Joined:
    Jul 20, 2013
    Posts:
    9
    @luispedrofonseca
    But i rotating mi camera 90 degrees on Z axis, so i still playing on XY axis
    This is for a game object who is "walking" on wall.
    So the objects rotates 90 degrees on Z and then the camera rotates 90 degrees on Z to match the object
    After activating shake method, the camera resets the Z rotation of the camera to 0
     
  49. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    829
  50. eddOrnelas

    eddOrnelas

    Joined:
    Jul 20, 2013
    Posts:
    9
    Thank you :):)
     
unityunity