Search Unity

  1. Click here to receive a gift with your purchase of Unity Pro or Unity Enterprise.
    Dismiss Notice
  2. 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

[Deprecated] Simple RPG Camera

Discussion in 'Assets and Asset Store' started by Ninjaxim, Oct 2, 2013.

  1. Ninjaxim

    Ninjaxim

    Joined:
    Jul 23, 2013
    Posts:
    105
    @Liminal-LLC,

    Great! The Cursor.lockState was being set every frame in a couple locations. I just added some if statements to only assign the value when it needs to be changed instead of all the time. Previously I had thought it was alright, but I guess not!

    Thanks for finding the issue! If you need anything else, don't hesitate to ask.
     
    Multithreaded_Games likes this.
  2. Multithreaded_Games

    Multithreaded_Games

    Joined:
    Jul 6, 2015
    Posts:
    122
    @Ninjaxim

    So I noticed on my test scene that when I right-click and rotate the camera, everything works as expected, the cursor is locked properly and becomes 'unlocked' when the right mouse button is released.

    In our actual game though, I noticed that when I right-click and rotate the camera, the mouse stays 'locked' (IE, it disappears entirely) The cursor only reappears when I hit 'escape', (but this might be a consequence of our game input/architecture and not reflective of anything in Simple RPG Camera)

    I haven't spent a lot of time digging into this issue, but I am certain it's related to the Joystick rotation being enabled at the same time, which I use in the game, but not in the test scene I was previously working in. If I select "Use Joystick" and right-click rotate the camera, it stays 'locked'. If I disable this option, the mouse cursor reappears as expected and as was the previous behavior.

    I'm confident that this issue was introduced with the fix you made to prevent cursor lock spikes. To test this though, you don't even need an actual joystick (we're using an XBOX360 controller), but you can simply select 'Use Joystick' and supply any Horizontal/Vertical input names you want (just to stop errors associated with not having a valid input name) and the problem will appear the next time you rotate the mouse with the right mouse button. Also make sure that Cursor lock is selected and 'Right Button' beneath that.

    I didn't want to dig into the code itself, but it should be fairly trivial for you to fix, being familiar with it :) Just wanted to bring it to your attention, but it's not exactly a super-critical issue at the moment. Thanks!

    -Derek
     
  3. Ninjaxim

    Ninjaxim

    Joined:
    Jul 23, 2013
    Posts:
    105
    @Liminal-LLC

    Sorry about that, you're correct it was an issue with the Use Joystick option. It should now be fixed in the latest version on my website (v2.5.2d). Let me know if the fix works or causes any other issues.
     
  4. Multithreaded_Games

    Multithreaded_Games

    Joined:
    Jul 6, 2015
    Posts:
    122
    @Ninjaxim

    It does indeed fix the issue--however, I wanted to point out that the code changes cause another issue if you don't have valid Joystick input names set up. This happens regardless of whether or not "Use Joystick" is enabled--just wanted to let you know--the snippet below illustrates the problem (near the top of Update):

    bool usingJoystick = false;
    float joystickX = Input.GetAxis(joystickHorizontalAxis);
    float joystickY = Input.GetAxis(joystickVerticalAxis);

    if(useJoystick && (joystickX != 0 || joystickY != 0))
    {
    usingJoystick = true;
    }

    Keep up the good work and thanks again.
     
  5. Ninjaxim

    Ninjaxim

    Joined:
    Jul 23, 2013
    Posts:
    105
    @Liminal-LLC

    Thanks for noticing that, the error should no longer show up if Use Joystick is disabled in v2.5.2e.
     
  6. LNMRae

    LNMRae

    Joined:
    Dec 28, 2012
    Posts:
    45
    Hey, Ninjaxim. Been using your camera for a while now, love how it just works out of the box without much effort. I'm currently having an issue though, I can't get any of the fade options to work. I know that things are properly set because the replace shader option will work, but I can't get any of the other options such as fade amount, fade speed, etc. to do anything. Is there some secret to getting it to fade?
     
  7. Ninjaxim

    Ninjaxim

    Joined:
    Jul 23, 2013
    Posts:
    105
    Hi! What are you trying to fade, the target or the environment?

    For the current target, all you need enabled is the Fade Current Target setting, and the Fade Distance under that controls how close the camera needs to be before fading occurs. You also need to be sure your target's material can be faded (has Rendering Mode set to Fade or Transparent). If it doesn't and you don't want to change it, you can use the Replace Shaders option with one that does.

    For fading environment objects, you need to set one or more Collision Alpha Layers. The Fade Amount controls how transparent you want the object to become, and the Fade Speed controls the speed at which it fades. The objects you want faded need their layer set to one of those that you selected for the Collision Alpha Layers on the camera.

    If you're still having trouble let me know!
     
  8. LNMRae

    LNMRae

    Joined:
    Dec 28, 2012
    Posts:
    45
    Thanks so much for such a quick response. I had a feeling that it had something to do with the shaders I was using and that confirmed it-none of them had the fade option. Got everything working as expected now, thanks again!
     
  9. Ninjaxim

    Ninjaxim

    Joined:
    Jul 23, 2013
    Posts:
    105
    Excellent! You are very welcome, feel free to ask if you have any other issues!
     
  10. zenforhire

    zenforhire

    Joined:
    Nov 5, 2012
    Posts:
    58
    o Have an issue about jitter/stutter or lag of image when the target turns fast. Like the camera cannot keep up with target. The target has a rigidbody. Could not find an answer in this thread. Using the latest version. Happens with all the versions we've had.

    o can I make it stationary and not follow a target and keep all the controls? Just not assigning a target did seem to work.

    Cheers
     
  11. Multithreaded_Games

    Multithreaded_Games

    Joined:
    Jul 6, 2015
    Posts:
    122
    @zenforhire,

    Assuming we are talking about the same 'rotationally-induced jitter', this is a manifestation of a problem I (and many, many others) have been fighting for a very long time. I can say that this isn't a problem with the SimpleRPGCamera, but more about how Update, LateUpdate, FixedUpdate, Rigidbodies and the Camera all play together. I have spent a long time experimenting and the only way I was ever able to remove the jitter on everything was to run the camera with the 'same' update that is being used for the character. Nothing else I tried ever worked--not setting Physics to Interpolate, not using MovePosition/AddForce/direct velocity updates, nothing.

    Assuming you are moving your character in FixedUpdate, it should be as simple as changing the Camera to include a FixedUpdate function that includes the contents of Update, then the contents of LateUpdate. I ended up putting Update/LateUpdate into their own functions, respectively, called like UpdateInput/UpdateView, and then called them in sequence from FixedUpdate.

    I won't say that this method is completely 100% foolproof as it will make your camera updating 'fixed', IE, it will run at the rate that your physics timestep updates. I think you also want to make sure that you are updating your Rigidbody with a 'physics' function, such as setting the velocity directly, AddForce or MovePosition. I don't think it matters, but we are also updating our input in FixedUpdate--for a semi-open-world RPG that doesn't need frame-perfect controls, this has no negative side effects. Hopefully this helps to alleviate the jitter--and yes, you might be inclined to think that this solution is 'cheating' and in a way, it kind of is, but after several months having wrestled with the problem, I had no qualms with it :)
     
  12. zenforhire

    zenforhire

    Joined:
    Nov 5, 2012
    Posts:
    58
    Thanks for clear explanation. I can try to make the fix.
    Never would have figured out the XXXXUpdate stuff. Beyond my pay grade.

    Yes the RB is pushed in an FixedUpdate using addforce.
    It's a ship that is under the control of the physics engine.
     
  13. Ninjaxim

    Ninjaxim

    Joined:
    Jul 23, 2013
    Posts:
    105
    @zenforhire This is certainly possible, and I'm not sure why I haven't changed this sooner. To enable control without a target, just make the changes I list below and it should work. I'll include the changes in the next update.

    SimpleRpgCamera.cs changes:
    Code (csharp):
    1. // Line 1388
    2. // Change from this:
    3. if(target && _focalPoint)
    4.  
    5. // To this (remove "target &&"):
    6. if(_focalPoint)
    Code (csharp):
    1. // Line 1448
    2. // Change from this:
    3. Quaternion cameraRotation = (useTargetAxis ? target.rotation * angleRotation : angleRotation);
    4.  
    5. // To this (add "target &&"):
    6. Quaternion cameraRotation = (target && useTargetAxis ? target.rotation * angleRotation : angleRotation);
    Code (csharp):
    1. // Line 1508
    2. // Change from this:
    3. if(ignoreCurrentTarget)
    4.  
    5. // To this (add "target &&"):
    6. if(target && ignoreCurrentTarget)
     
  14. zenforhire

    zenforhire

    Joined:
    Nov 5, 2012
    Posts:
    58
    Need settings for limiting relative rotation angles not absolute.
    Rotation/Limit X Angle

    My use case is binoculars fixed in place on the ship. Want limit to turn right/left. Not look behind into the walls of the ship.
    When ship vector is forward, the limits behave as expected.
    When ship turns 90 degrees, The limits seem to be absolute world space.
    They don't appear to stay behind my target?
     
  15. Ninjaxim

    Ninjaxim

    Joined:
    Jul 23, 2013
    Posts:
    105
    @zenforhire

    Apologies for the late reply. To get limit X rotation locally instead of globally, enable Use Target Axis under Target Settings.
     
  16. Multithreaded_Games

    Multithreaded_Games

    Joined:
    Jul 6, 2015
    Posts:
    122
    Hi @Ninjaxim

    Running into some stuttering issues with the 2.5.2 version of the camera. I've made a video that shows this 'stutter'--this is actually using one of the provided test scenes and the stuttering is present. I honestly can't tell what's going on or if other camera solutions would exhibit this same behavior, but this problem is magnified tenfold on our much more complex scene. Unfortunately this makes the camera almost unusable as there is near-constant stuttering. I'm not sure if this issue has always existed or if it's something that has been somehow introduced in a recent update.

    Even running at a consistent 30 or 60 FPS seems to have no effect on the stutter and it is random as far as I can tell. In the video, there is a stuttering period around :08 - :12 and another towards the end of the video with possible intermittent ones thrown in. I find it more noticeable as well when looking at the mountain peaks.

    Again, this should be fairly simplified--there is no translation or real movement, simply what should be a 'constant' rotation using the Numpad as input. Hope you can help figure this out, but the first step would be seeing if it can be replicated. I haven't noticed anything bizarre in the profiler, but I also haven't spent a lot of time looking into it.

    Here's the link to the video:


    Thanks for your time and support!
     
  17. Ninjaxim

    Ninjaxim

    Joined:
    Jul 23, 2013
    Posts:
    105
    @Multithreaded_Games

    Your video seems to be unavailable, but I do notice a slight stutter as well testing it myself. I will look into it and get back to you soon.
     
  18. Multithreaded_Games

    Multithreaded_Games

    Joined:
    Jul 6, 2015
    Posts:
    122
    Ah... I accidentally made it private, whoops. Either way, it's awesome that you're able to replicate it. Thanks!
     
  19. gearedgeek

    gearedgeek

    Joined:
    Jun 19, 2015
    Posts:
    188
    Has anyone used this asset with ORK Framework?
     
  20. Ninjaxim

    Ninjaxim

    Joined:
    Jul 23, 2013
    Posts:
    105
    @gearedgeek I have not used ORK Framework before, so I'm unsure how compatible it is with Simple RPG Camera. I don't think there should be a problem, but if you try it and have issues, I'd be happy to try and help.

    @Multithreaded_Games Sorry it's taking a while, I haven't found the exact cause of the stuttering yet. I have even created a script with just the basic code to rotate the camera and still see the issue. I am currently a bit busy with another project too, so I haven't had a lot of time for it. When I get the chance I'll take another look and see if I can find a solution to fix it.
     
    Multithreaded_Games likes this.
  21. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    918
    Yes, it works wonderfully with ORK. That's why I recommended it to you. ;)
     
  22. Multithreaded_Games

    Multithreaded_Games

    Joined:
    Jul 6, 2015
    Posts:
    122
    @Ninjaxim,

    Wow, it even happens with a simple camera rotation script? You're talking about something that's completely different from the SimpleRPGCamera script? That's pretty concerning, almost like it's some kind of Unity issue.

    Either way, I have plenty of stuff to keep me busy, but please let me know if you find anything!
     
  23. Multithreaded_Games

    Multithreaded_Games

    Joined:
    Jul 6, 2015
    Posts:
    122
    Hi @Ninjaxim

    Was just wondering if any headway has been made with this issue? Thanks!
     
  24. Ninjaxim

    Ninjaxim

    Joined:
    Jul 23, 2013
    Posts:
    105
    @Multithreaded_Games

    Sorry still haven't had much time for it. I'll attach the test script i was messing with here in case you'd like to see if the stutter still exists using it.
     

    Attached Files:

  25. Paul-Swanson

    Paul-Swanson

    Joined:
    Jan 22, 2014
    Posts:
    289
    When using ORK framework on 5.6 Unity The camera ignores Camera blocks now. This used to work last year. Not sure exactly when it stopped. Also not sure which asset is a fault for this either. I can provided more info if required, just let me know what you need.
     
  26. Ninjaxim

    Ninjaxim

    Joined:
    Jul 23, 2013
    Posts:
    105
    @Paul-Swanson

    I replied to your post on my forum, but will say the same here:

    I don't think I've made any changes that would affect ORK's behavior of disabling the component when needed, so I suggest you contact the devs for ORK and see if they can help you solve the issue. I don't have access to their source code, so I don't know what could be wrong.

    Sorry I couldn't be of much help with the issue! Let me know if you discover that my package is the one at fault and what the issue is so I can fix it for you.
     
  27. Paul-Swanson

    Paul-Swanson

    Joined:
    Jan 22, 2014
    Posts:
    289
    Well...as it turns out...what happened was, I'm an moron.
    My deepest apologies for the time wasted on this :/ in the behaviors I put 'Simple Rpg Camera' I Should have put 'SimpleRpgCamera' (no spaces, script name )instead. Totally my fault. I even wrote a freaking tutorial on this on the ORK site.


    I'll reply on the other thread as well to close the loop. Again, thx a ton for taking the time to look
     
    Last edited: May 23, 2017
  28. Ninjaxim

    Ninjaxim

    Joined:
    Jul 23, 2013
    Posts:
    105
    Hey no worries, glad you were able to find the problem. Feel free to ask if you have any other issues.
     
  29. jagatai33

    jagatai33

    Joined:
    Feb 2, 2016
    Posts:
    164
    Apologies in advance if this has already been asked, however i was unable to find an answer.

    Im currently using Gaia along with Simple RPG Camera v2.5.2, i cant seem to find the option (or a how-to) to make the trees fade, it collides fine, however i would like to have it fade instead (trees are the standard unity asset).

    any help is greatly appreciated.
    -J
     
  30. Ninjaxim

    Ninjaxim

    Joined:
    Jul 23, 2013
    Posts:
    105
    I don't believe it will work if they are placed using the terrain tools, I have not used Gaia though.

    If they are placed as individual objects in the scene then it's just a simple matter of setting the camera fade layer to that of the object's layer, and make sure the object uses a transparent shader (or use the replace shader option on the camera).
     
  31. Paul-Swanson

    Paul-Swanson

    Joined:
    Jan 22, 2014
    Posts:
    289
    Gain doesn't place trees thru the terraintools. It makes them unique objects so you can move them individually. Or remove them. Maybe you didn't set up your prefabs correctly.
    Try his suggestion with the layers. That should do it. Nice thing about gaia, is you can do this enmasse after the trees are already placed
     
  32. IndieGameHustle

    IndieGameHustle

    Joined:
    Jul 25, 2012
    Posts:
    63
    It really is a great camera! I was just wondering if this camera is still be supported? I am having a issue with the camera rotation speed changing based on the size the of window.
     
  33. IndieGameHustle

    IndieGameHustle

    Joined:
    Jul 25, 2012
    Posts:
    63
    Hold on that!
    I just noticed that there was a update since Feb I did not do. I will see if my issue was corrected. !!
    I do hope you are still supporting this asset! It is very good and very effective. Easy to understand for the none coder.
     
  34. Ninjaxim

    Ninjaxim

    Joined:
    Jul 23, 2013
    Posts:
    105
    Yes I am still supporting this package, let me know if the updated version works out or if you still have trouble.
     
  35. Hellwaiker

    Hellwaiker

    Joined:
    Jan 8, 2016
    Posts:
    91
    Hey! I can't run web demo in any browser, is there a PC demo I could try?
     
  36. Ninjaxim

    Ninjaxim

    Joined:
    Jul 23, 2013
    Posts:
    105
  37. Hellwaiker

    Hellwaiker

    Joined:
    Jan 8, 2016
    Posts:
    91
    @Ninjaxim Thank you!
    The camera looks great!
    Is it possible to block pan controls and ground height follow regions in certain regions? For example, in your demo the big mountain in the center sort of bumps the camera to the top of the mountain, so for example is it possible to place some custom collider with certain layer or tag on that mountain to block height follow for that region, and stop panning when camera collides with it?
     
  38. Ninjaxim

    Ninjaxim

    Joined:
    Jul 23, 2013
    Posts:
    105
    No not currently. At the moment it only has the ability to set a bounding box for panning limits, but that is a nice idea to have it collide with specific objects. I might be able to add that in sometime depending how complicated it might be, but it sounds fairly simple. I will play around with it over the next week or so whenever I have some time.
     
  39. Ninjaxim

    Ninjaxim

    Joined:
    Jul 23, 2013
    Posts:
    105
    I am sad to say it, but this will be the final update to Simple RPG Camera. It has been a great experience supporting this package for so long (about 4.5 years!), but it has come time to deprecate it from the Asset Store. The reason being that I am not generating many sales anymore, and there are so many camera solutions out there for Unity that I feel my package is no longer needed.

    I do not want to just deprecate it without warning, so I am reducing the price by 50% for one month (until Feb. 1st, 2018), at which time I will be removing it from the Asset Store. I will continue support for one month after deprecation to help those who need it, but as of March 1st, 2018 I will discontinue all support for it.

    Thank you all so much for supporting my work! I may release new packages in the future, but currently have no plans to at this time.



    Changelog for v2.5.3:

    • SimpleRpgCamera.cs:
      • FIX: A target is no longer required for camera rotation control to function
      • Movement Settings
        • FIX: Fixed an issue that caused panning to become inverted
      • Zoom Settings
        • NEW: Reset Key - Resets camera zoom distance to the default on press
     
  40. sjm-tech

    sjm-tech

    Joined:
    Sep 23, 2010
    Posts:
    709
    I'm sorry to hear this decision. I love SRPG Camera and it is still my favorite solution with infinite fields of use and great support.
    Why deprecate it? it still works great! You could maintain occasional compatibility by updating each new version of Unity to make it work leaving it on asset store.
    However I understand your position and I hope you could come back with a new product at some point.
    best
    Max
     
  41. Hellwaiker

    Hellwaiker

    Joined:
    Jan 8, 2016
    Posts:
    91
    Sad to hear this as well. Even with this news I will most likely be getting this camera for my game, as others kind of fail to do same features well.
     
  42. Paul-Swanson

    Paul-Swanson

    Joined:
    Jan 22, 2014
    Posts:
    289
    This makes me really sad, this really is THE best camera on the store. its the only full featured and smooth 0 performance loss one.
     
    sjm-tech likes this.
  43. Hellwaiker

    Hellwaiker

    Joined:
    Jan 8, 2016
    Posts:
    91
    I bought the camera :D I just love it.

    @Ninjaxim
    What do movement hit distance and hit buffer do?
     
  44. Ninjaxim

    Ninjaxim

    Joined:
    Jul 23, 2013
    Posts:
    105
    @Hellwaiker

    Movement Hit Distance is where the raycast will start above your focal point to detect collisions (in meters, casting downward).

    Movement Hit Buffer is the distance away from the detected collision point that your focal point will be placed (in meters, going upwards).
     
  45. Ninjaxim

    Ninjaxim

    Joined:
    Jul 23, 2013
    Posts:
    105
    Thanks everyone for your interest and support. I'll still be deprecating the package tomorrow, but feel free to join me on my little Discord server if you'd like to chat about anything.

    https://discord.gg/qkrV9jf
     
unityunity