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

Camera Controller Release

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

  1. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    Nice! I don't think I should add this to the core code since I don't want to mess with existing users, but once I submit the update you should be able to make the change and use your solution + the options I'm adding.

    Good job!
     
  2. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    The Adventure Camera & Rig have been updated with the requested feature! :D

    You can now choose a mouse button 'activator' for moving and viewing. Thanks @datsun80 and @TonyLi for the great idea. This will work with the Motion Controller as well.
     
  3. datsun80

    datsun80

    Joined:
    Mar 15, 2015
    Posts:
    13
    Another question for you. How can I limit the camera movement so it doesn't allow me to rotate it in front of the character?
     
  4. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    Hey datsun80,

    In the inspector, the 'y' and 'z' values for 'Yaw' are limits. If you set them to something like -90 and 90, you won't be able to rotate to the front. That's how we limit pitch too.



    I did this before I got better at inspector code. Eventually, I'll make that less cryptic. ;)
     
  5. datsun80

    datsun80

    Joined:
    Mar 15, 2015
    Posts:
    13
    Thanks!
     
  6. imaginationrabbit

    imaginationrabbit

    Joined:
    Sep 23, 2013
    Posts:
    349
    Hey Tim- I'm trying to get the IndAdventureRig ver 1.5 script to work with the new "Rollerball" prefab character that is in the Unity 5 standard assets-

    The Rollerball doesn't move in reference to the camera- if you ever get a chance to check it out some tips to get it working would be awesome- thanks for your time-
     
  7. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    I'll give it a try this week. I wonder if the rollerball has a "forward" or if (as a ball) that concept changes for it. I'll take a look.
     
  8. imaginationrabbit

    imaginationrabbit

    Joined:
    Sep 23, 2013
    Posts:
    349
    I did my best to get it working but yeh the ball gets confused as to the cameras orientation when it rotates so then the ball controls stop working correctly-

    Also I just saw you released Bone Controller- It looks great! I was looking at Final IK but since I own your other assets and they are great I added it to my wish list ^ ^ Thanks!
     
    Tryz likes this.
  9. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    Hey @mdotstrange ,

    I loaded up the RollerBall scene and got the Adventure Camera working with it. The only thing I had to do different was disable "Use Smooth Movement" because the ball's start-and-stop was causing the camera to "stutter".

    Basically, did the following:
    1. Added the standard "Camera Rig" empty Game Object to the scene
    2. Added the Independent Adventure Rig as a component
    3. Set the component's 'Camera' and 'Anchor' properties
    4. Moved the "MainCamera" under the Camera Rig
    5. Commented out the "Cameras" object that was already in the scene

    Since the RollerBall controller has momentum, I found I used the camera's orbit to compensate and ensure the ball didn't fall off the ramps, but I was able to get around the top edge of the maze...for a bit.

    Let me know if you're not seeing the same thing.
     
  10. imaginationrabbit

    imaginationrabbit

    Joined:
    Sep 23, 2013
    Posts:
    349
    Followed your steps and now it works- thanks again for checking it out Tim!
     
    Tryz likes this.
  11. BackwoodsGaming

    BackwoodsGaming

    Joined:
    Jan 2, 2014
    Posts:
    2,229
    I'm running into some issues trying to use the camera rig with ORK. I added an empty gameobject and moved my main camera to be a child of it. I then put the independent adventure rig script on the new gameobject and configured my camera. My problem is, the player prefab isn't actually part of the scene, it is spawned by ORK's spawner. Is there a way that the camera rig can be reconfigured to target/follow the Player tag instead of a prefab?
     
  12. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    Hey Shawn67,
    In the Motion Controller forum, someone had a similar situation.

    I don't use ORK, but what I learned is that it spawns objects dynamically. So, the standard assignments and initialization weren't there.

    About half way down the page, modulo34 detailed what they did to get it working. I believe they had to register the camera through code that ORK called. I don't think it was difficult once they figured it out.

    Check out the forum. It should help.
     
  13. BackwoodsGaming

    BackwoodsGaming

    Joined:
    Jan 2, 2014
    Posts:
    2,229
    That would be good.. But the problem I'm having is, in the Ind Adeventure Rig script, what would I set my anchor to? I have no player object in the scene that I can assign there since it is dynamically spawned. I tried putting the prefab from the file list there, but it doesn't seem to work.

    I did try a custom control earlier but it didn't help either. I sent Modulo a message. Wondering if maybe something in the custom control wasn't setup right. I couldn't find any examples on setting it up. So I may have interpreted the setup wrong.

    I'll keep playing.. But if anyone else following this thread has got this working with dynamically spawned players, or better yet specifically with ORK, I'd love any input I can get.. lol
     
  14. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    Inside the Start() function of the IndAdventureRig, you'd have to find the transform of your character controller.

    Here's what I sent to Modulo that seemed to work for him. It's was originally for the Motion Controller, but I tweaked it for you and it should work:

    _Anchor = GameObject.FindGameObjectWithTag("MainPlayer").transform;


    If ORK hasn't created the character yet, then you may need to add the code to some initialization script that ORK will call. Modulo and I bounced it around a couple of times in the thread. So, there may be more in there than can help you.
     
  15. BackwoodsGaming

    BackwoodsGaming

    Joined:
    Jan 2, 2014
    Posts:
    2,229
    At this point I don't really even need ORK to know about the camera because I'm not doing any of the fancy zoom in and zoom out stuff via ORK. I just need the camera to be able to target a prefab that isn't a static part of the scene and anchor to it. I was looking at the code in the other thread, just haven't had a chance to play around with it yet. For some reason my UnityVS doesn't seem to be working in Unity 5 and trying to work that out. Haven't played with code in months.. lol

    I like the solution of using a check for _Anchor and if it isn't set, search for the tagged Player option. Might be something good to add to the original source. Just need to figure out the right place to put it in the code to ensure that it is running when it needs to. I would think you would be having this issue with PlyGame, RPG Kit, and any other project that works with spawn points to spawn the player object or lets the player choose their model since all of those would be dynamically spawned after the scene loads.

    I'll play with it the next couple of days and let you know if I find a solution to work. In talking with Modulo, he never got it to work and abandoned it.

    Thanks for all the suggestions! Wish me luck! lol
     
  16. BackwoodsGaming

    BackwoodsGaming

    Joined:
    Jan 2, 2014
    Posts:
    2,229
    Adding the following code to the very top of the Update() method now has the camera following a player spawned dynamically. Probably need to do something in ORK if I plan to use any of their camera transitions within ORK events. But to just get camera to follow a dynamically spawned player all you need to do is add this code and make sure your players spawn with an object that has the Player tag.


    Code (CSharp):
    1.             // Check to see if _Anchor is assigned, if not then look for object with Player tag
    2.             if ( _Anchor == null )
    3.             {
    4.                 _Anchor = GameObject.FindGameObjectWithTag("Player").transform;
    5.             }
    6.  
     
    Tryz likes this.
  17. blueivy

    blueivy

    Joined:
    Mar 4, 2013
    Posts:
    630
    @Tryz I'm having this same issue, I'm using motion controller which was previously accepting my input but my character isn't moving anymore. Also how can I have it where I don't have to hold right click to move the camera, I'd rather move it without having to hold it down. But I would like to have the middle mouse wheel be remapped to right click so when a player right clicks it does that zoomed in over the shoulder view.
     
  18. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    Hey Blueivy,

    I just replied to the conversation. I'm currently traveling out of the country and Internet is spotty. So I will help as best I can.

    Please make sure your Unity input settings continue to follow the settings from the MC zip file. Also, make sure to use the InputManager.cs from the MC. They are the same in both assets, but just in case. The are in the MC docs.

    To change the activation mouse button, there is a component you can add to a basic Game object called InputManagerController (or something close) add that allows you can changet the buttons easily. I talk about it in the MC docs.

    With me being gone, you may want to start a new project, import the MC, import the AC&R, follow the MC documentation for using the two. The AdvDemo scene from MC will work no problem. It has the input component I just mentioned too. Use this as an example to go by.

    Hope that helps.
     
    blueivy likes this.
  19. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    Adventure Camera v2 is Live!

    This is a total re-write and major update with a lot more features. For existing ACR users, it's also a FREE upgrade. :D



    Features Include:
    • Modern 3rd Person follow behavior
    • 360-degree view of the character
    • Silky smooth camera orbiting
    • Yaw and pitch speeds
    • Alternate mode for targeting
    • Field-of-view zooming
    • Advanced line-of-sight detection
    • Advanced collision detection
    • Character fading
    • Customizable camera shaking
    • Works with any character controller
    • and more...
     
    FargleBargle and BackwoodsGaming like this.
  20. imaginationrabbit

    imaginationrabbit

    Joined:
    Sep 23, 2013
    Posts:
    349
    Awesome! Thank you Tim! :)
     
    Tryz likes this.
  21. FargleBargle

    FargleBargle

    Joined:
    Oct 15, 2011
    Posts:
    773
    As one of the lucky users who got an advance look at the new Adventure Camera during testing, I think most of you will be very happy with this. It really does deliver the goods. This is the first camera solution I've used that not only does everything I want it to now, but I'm confident will do anything I ask of it in the future. Get it while it's hot folks! :)
     
    Tryz likes this.
  22. BackwoodsGaming

    BackwoodsGaming

    Joined:
    Jan 2, 2014
    Posts:
    2,229
    I'll say ditto to everything @FargleBargle mentioned here. I think I posted something similar in the Motion Controller thread. So far I am very impressed with the performance of the Adventure Camera. So far I haven't seen any of the clipping issues that I had with other cameras that I have tried.
     
    Tryz likes this.
  23. ikemen_blueD

    ikemen_blueD

    Joined:
    Jan 19, 2013
    Posts:
    341
    Just a very quick test. I'm not sure if I like Camera from ACR_Temple. It looks like Camera collision is fighting to get control too much. For example, keep holding Up key, run toward a Pillar, you will see Camera skaking like crazy. Or, like the gif link below, Camera collides with a Pillar and then collides with a Player, so Camera moving forward backward continuously. And, we get a very jittery look.
    http://gph.is/1Qxb6Hj

    Anore quick test, I super like the ACR_Demo. You can see Camera collision handles very well in here.
    http://giphy.com/gifs/d2Zg3uj9YFSS7EYM

    I purchased Motion Controller, Actor Controller, Adventure Camera. I'm thinking to buy Bone Controller later. I'm not sure about Bone Controller, compare to Final IK. Any tried these two assets, can give me some hints?

    Anyway, ooti plugins are really cool. I have to finish Jonh Mac tutorials soon. So, I can get some gist concepts about Character Controller & Camera Controller to read his code. And, I will do some more test, I want to see how AAA Quality Adventure handles the Near Clip Plane collisions though.

    @Tryz please improve Actor Controller performance as much as possible hehe for now, without OC, without LOD, without disable objects from range, I can run 100 AI Spiders, with 30 fps. But, I want even cheaper performance if you could :) . Do you think it is needed to implement over frames or multi-threads for Actor Controller?
     
    Last edited: Dec 10, 2015
  24. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    The gifs are great! :)

    For ACR_Temple, I'm not able to reproduce the shaking. I press play and I can see the full character in front up me. Then, I press up and run into a pillar. All that happens is the character keeps running into the pillar, but doesn't go anywhere (as expected). I've tried a bunch of different camera rotations and no wacky behavior like what I see in the gif. Weird.

    Is this happening every time? Any other steps you can give me to reproduce this? Maybe a screen shot of your advanced settings would help.

    haha... I'll try. 100 characters at 30 fps doesn't sound too bad. ;) The bulk of the work is the collision detection. In some cases, you can disable that if a nav-mesh is handling character movement and dynamic avoidance.

    I'm not sure about a multi-threaded approach because in the end I have to ask Unity physics for information about collisions and raycasts. I'm not sure it can do that outside of the main thread. Then, I need to ensure the results of that can be applied before the frame finishes. It's interesting, but I'm not sure.
     
  25. ikemen_blueD

    ikemen_blueD

    Joined:
    Jan 19, 2013
    Posts:
    341
    @Tryz
    Yes, it happens everytime :(
    - I'm using Unity Pro 5.2.3f1. I started a new project, imported AAA QA Camera plugin. I did not touch any settings.
    - In ACR_Temple demo, in Exploration mode, I tried to run towards to the Camera --> Camera moving back, still holding S key.
    - Still holding S key, Player still running towards to the Camera. When Camera got stuck in a pillar, still holding S key, the Camera View started to shake.
    - Same for ACR_Temple demo.
    - It depends on where Camera gets stuck, while moving backward as Player moving towards to it. I notice Camera shakes more if Camera stuck at a Pillar corner.

    Hey, thanks for the tip. I haven't read your code so I'm not sure which is the most expensive work among other works from AC. I will try to figure out when is the best time to disable the collision detection, to squeeze some more performance. My game is RTS style, using Terrain. So, I need a unit of hundreds to move to a position, but still collision detection. I guess your AC work needs to be done all in the main-thread, and in one frame. I'm thinking another approach then, probably moving each AI a bit over frames or something else.
     
    Last edited: Dec 10, 2015
  26. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    I tried for a while and couldn't get the shaking to happen. I even made this poor quality video. :)


    Then, I noticed that your character looked like he was really close to the pillar...too close. So, I forced the character inside the pillar's collider and I was able to duplicate the issue. So, that's good. Now, I need to think about how I handle it when the character is in the collider... since there's always a collision... hmmm....

    In an RTS, you're using lots of path-finding and nav meshes. Isn't the dynamic avoidance of the nav mesh what would keep the character's from colliding? I haven't built an RTS before, but I would think that the AI would dictate position and not collision detection.
     
    ikemen_blueD likes this.
  27. ikemen_blueD

    ikemen_blueD

    Joined:
    Jan 19, 2013
    Posts:
    341


    I should make a video. It is easier to describe the weird case.

    About RTS, Dynamic Avoidance helps AI to avoid climb each other or avoid some static or dynamic obstacles. But it won't help how AI walks over steps, sliding on slope or some smooth walking over terrain surfaces, or how to orient itself to surfaces. That's what your AC comes to help. I'm happy with the AC performance (still want more, hehe). The normal Character Controller kills FPS with just 10 CC around.
     
  28. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    I've uploaded an intro to the Adventure Camera 2.0. Enjoy. :)

     
    ikemen_blueD and BackwoodsGaming like this.
  29. RandAlThor

    RandAlThor

    Joined:
    Dec 2, 2007
    Posts:
    1,293
    Failed to import package with error: Couldn't decompress package
    UnityEditor.Web.JSProxyMgr:DoTasks()

    This is what i get every time even if i downloded the asset again from the store and start a new project.
    Can someone help? Am i the only one who get this error?
     
  30. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    I actually got this yesterday with someone else's asset.

    In the end I figured out that Unity failed to download the package fully, but it thinks it did. I ended up deleting the package from the Asset Store cache. That caused Unity to re-download... then everything worked.

    If you're using Windows, you can find the downloaded assets in the following folder:
    C:\Users\Tim\AppData\Roaming\Unity\Asset Store-5.x\ootii\ScriptingCamera

    (replace 'Tim' with your windows user name)

    Let me know if that fixes it. ;)
     
  31. RandAlThor

    RandAlThor

    Joined:
    Dec 2, 2007
    Posts:
    1,293
    Did not worked on the laptop but will try it at home on my desktop later. Maybe there it work.
     
  32. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    Just to make sure I wasn't going crazy: I deleted my cached package, created a new 5.3 project, re-downloaded and imported the ACR, and ran the demo. All was good here.

    Make sure you're deleting from the right user account.

    Unfortunately, if it still doesn't decompress you may need to contact Unity. :(
     
  33. gurayg

    gurayg

    Joined:
    Nov 28, 2013
    Posts:
    269
    @RandAlThor
    I've managed to download and extract without problems today.
    Downloaded file is 187MB (if it helps).

    @Tryz
    -How can we add our camera modes just like the targeting mode? for example running,crouching,game paused,death...etc?
    -Is it possible to do a constant shake for the camera (over the shoulder camera movement / handheld)?
    -"Fade" doesn't seem to work with standard shader. Is it easy to give any shader transparency?

    Thanks
     
  34. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    Great!

    The "Mode" property is just an integer. So, you can set it to any value you need. I have the enumerated values, but they just represent integers...they could be anything.

    If the Mode is not "0", the "Targeting Mode Properties" take over and control the offset, distance, etc.

    I never thought of that, but technically... yes.

    In the document, I show how to cause the shake by calling "Shake". The last parameter can be a duration. So, if you make it huge (86400 = 24 hours), it will continue to shake. To shut it off, you should be able to call Shake again with a 0 duration.

    Because I shake the camera itself and not the rig, it won't effect normal camera movement.

    You have to set the "Rendering Mode" of the standard shader to "Transparent".
     
  35. gurayg

    gurayg

    Joined:
    Nov 28, 2013
    Posts:
    269
    Thanks Tryz!
    So adding a "Mode" requires adding a new entry to "EnumCameraMode" and calling it from "AdventureRig"?
    So all the required code goes into "AdventureRig" and (if necessary) I should be adding some code to editor script as well (for inspector editing)?

    I've already tried that. Standard shader transparency looks funky. Objects render on top of each other.
    Also at the end of the "Fade speed" character is still visible just a little bit. This is more pronounced in "Gamma" mode.

    Everything seems fine (except objects rendering on top of each other issue)
    if I use "Linear" and "Fade" "Rendering mode from Standard shader.

    I want to use "Mouse ScrollWheel" to change the "Anchor Distance" instead of "FOV" but only in "Exploration" mode.
    Is there a way to change how input works based on the Camera mode?

    Thanks so much for your help Tryz!
     
  36. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    No. Think of EnumCameraMode as just a short cut for 0, 1, 2, etc. Since Mode is an integer, you can just do this:
    Camera.Mode = 87;

    Not really. It depends on what you're trying to do. I did put the swapping of mode in the camera for normal mode (0) and targeting mode (2) because it was generic to everyone. If you want to have other modes that your character respects, you could set it outside of the ACR and never modify the ACR at all. Again, it's just an integer you can set from where ever makes sense for your goal.

    You can use a different shader if you want. In the ACR, I'm just accessing the "color" property of the shader and setting the alpha. What ever shader you use would just have to read that color value and respect it.

    This would be a function of the shader. At the end of the fade, I disable the renderer (if you have that check-box checked) so absolutely nothing is rendered. If the standard shader isn't working well, you could use a different shader.

    The ACR doesn't include any special shaders because there's a ton of shader assets out there and I didn't want to force people into using mine. So, as long as it has a "color" property and uses the alpha channel for transparency, you can use any of them.

    What you could do is set the "AnchorDistance" or ("AltAnchorDistance") property where ever you are handling input. You don't actually have to modify the ACR. If you do want to use the mouse wheel instead of having the FOV do it, you just want to remove the "FieldOfViewActionAlias". This way it doesn't read the mouse wheel.
     
    gurayg likes this.
  37. Rusted_Games

    Rusted_Games

    Joined:
    Aug 29, 2010
    Posts:
    135
    With the new AdventureRig the workaround to use it with ORK Framework is to add the following block to the AdventureRig.cs class, it would be nice to have such support out of the box (just search for anchor by Tag).
    Code (csharp):
    1.  
    2. protected override void Update()
    3.   {
    4.   // Check to see if _Anchor is assigned, if not then look for object with Player tag
    5.   if (_Anchor == null)
    6.   {
    7.   _Anchor = GameObject.FindGameObjectWithTag("Player").transform;
    8.   }
    9.   base.Update();
    10.   }
    11.  
     
  38. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    Is there any way to add that code to Awake() or Start()?

    I know it's a tiny overhead, but I hate adding that to everyone for every frame regardless if they use ORK or not.

    It seems weird that ORK doesn't allow for initialization somewhere.


    @FargleBargle , I'm adding you because I thought you had ORK experience...
     
  39. Rusted_Games

    Rusted_Games

    Joined:
    Aug 29, 2010
    Posts:
    135
    I did tried in both Awake() and Start() with no luck. I know is a little of a pain thou having support for spawned players is something that must of us will appreciate.
     
  40. FargleBargle

    FargleBargle

    Joined:
    Oct 15, 2011
    Posts:
    773
    Actually I don't have ORK experience. In fact, in spite of seeing the term ORK thrown around before, I had to look it up just now to see what it does. :( While my game includes some of that stuff, I'm not using any third party tools to do it. I'm just stumbling around in the dark, trying to figure my own solutions out. ;)

    That said, I've had to use similar code to what @alardaen posted to let various scripts find my player and other persistent objects when switching levels, or when instantiating a Player on startup. I usually put it in Start rather than Awake, to be sure the Player is there to be found, and include an error message if it can't. You sometimes even need to put a small delay in before attempting to detect an instantiated player, since it might not be there immediately on startup. Since it only runs at Start, it doesn't really impact performance much.
     
  41. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    Let me contact ORK and see what they say.

    I'm totally cool with helping to support the spawned players. I just wish that package had a better approach than calling something forever in the Update function. That's just messy and super inefficient. :eek:
     
  42. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    Rats. Maybe it was one of the other guys. Sorry about that. ;)
     
  43. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    @alardaen , Someone replied with this...

    "Try using OnEnable. A lot of people don't seem to be aware of this one. I use it for things like that and it works fine."

    Would you try putting the code there? If that works, I'll definitely make the change.

    Thanks!
     
  44. Rusted_Games

    Rusted_Games

    Joined:
    Aug 29, 2010
    Posts:
    135
    I did tried also there with the same bad result.
    At the end I will have to maintain a custom copy of the AdventureRig component since I also had to add the same _Anchor check inside the RigLateUpdate call where the _Anchor is null (cheking the lTiltDelta) after returning from the Battle System.
    The OnEnable did became handy when I needed to restore the localPosition of the Camera after a Battle were ORK uses the change camera positions to add cinematic actions to it ;)

    My next challenge is to integrate your awesome MotionController into ORK Framework as well.


    Cheers
     
  45. BackwoodsGaming

    BackwoodsGaming

    Joined:
    Jan 2, 2014
    Posts:
    2,229
    Heheh.. That was me.. Let me go back through my notes and see how I got it working. I had both MC and ACR working in my ORK test environment during MC2 beta.
     
    Tryz likes this.
  46. FargleBargle

    FargleBargle

    Joined:
    Oct 15, 2011
    Posts:
    773
    It's weird that none of those methods works, but there should be some way to avoid putting the test in an Update function. Did you try adding a delay before testing for the "Player" tag? Sometimes you need to give it a second before an instantiated player can be found with a tag search. I usually allow a bit of time before and after a "FindGameObjectWithTag" test, to be sure the Player has been fully instantiated, and to allow the tag search time to find him. It doesn't need to be much usually, but a few frames might make all the difference between seeing him and not. And it never hurts to verify the player is actually getting a "Player" tag in the first place.
     
  47. Rusted_Games

    Rusted_Games

    Joined:
    Aug 29, 2010
    Posts:
    135
    @Shawn67 I´ll appreciate if you can share your setup.
    @FargleBargle, doing something like:
    Code (csharp):
    1.  
    2.         private bool _waitActive;
    3.         protected override void Start()
    4.         {
    5.             base.Start();
    6.  
    7.             if (_Anchor == null)
    8.             {
    9.                 if (!_waitActive)
    10.                 {
    11.                     StartCoroutine(Wait());
    12.                 }
    13.  
    14.                 _Anchor = GameObject.FindGameObjectWithTag("Player").transform;
    15.             }
    16.         }
    17.  
    18.         IEnumerator Wait()
    19.         {
    20.             _waitActive = true;
    21.             yield return new WaitForSeconds(1.0f);
    22.             _waitActive = false;
    23.         }
    24.  
    Does the job although I´m still getting an error, while checking in the Update I have no errors.
     
  48. BackwoodsGaming

    BackwoodsGaming

    Joined:
    Jan 2, 2014
    Posts:
    2,229
    Did you also go into your ORK Framework window and under Base/Control -> Game Controls set both Player Controls and Camera Controls to none and then setup custom controls for player and character? In looking at the project I tested with, it was before Tim finished updating ACR. It is setup right now for MC2 using the Orbit Camera. I'll update it now and come back with screenshots of my ORK Framework settings. For the orbit cam, I did everything in Awake and it worked fine with no errors and I didn't have to do any kind of delay. The only thing I added was the if statement checking to see if anchor was null and set. Below is the code I used during testing. Tim mentioned that he was going to change MC2 to test for ICameraRig instead of testing for each MC camera script. I'm going to update to latest MC2 and test to see if it still works without changing scripts and then I'll load in ACR and work with it. Like I said, I'll post back with whatever I have to do to get it to work.

    Again, this is code I changed within OrbitRig in MC2 during beta and prior to Tim updating MC2. Similar "should" work with ACR as long as you have things set in your ORK Framework to reference them

    Code (CSharp):
    1. protected override void Awake()
    2. {
    3.      base.Awake();
    4.      OrbitRig tempRig = GameObject.FindGameObjectWithTag("MainCamera").GetComponentInParent<OrbitRig>();
    5.      if (tempRig.Anchor == null)
    6.            tempRig.Anchor = gameObject.transform;
    7. }
    EDIT: Current asset store version of MC2 works without needing any changes. Installing ACR now. Will do a new post shortly (hopefully) with screenies of config.
     
    Last edited: Dec 20, 2015
  49. Rusted_Games

    Rusted_Games

    Joined:
    Aug 29, 2010
    Posts:
    135
    @Shawn67, yes I have both Player and Camera Controls set to none and the Custom set correctly to the components, from your code I see you are checking the Anchor from the Player component. I will try that as well.

    Yep!! that worked better than expected, thanks again @Shawn67
     
    Last edited: Dec 20, 2015
    Tryz likes this.
  50. BackwoodsGaming

    BackwoodsGaming

    Joined:
    Jan 2, 2014
    Posts:
    2,229
    Don't... I just installed ACR and it works out of the box with no changes.. Doing screenies now.. will post here in a few min. I think the trick might be installing MC2 first? I didn't do any code changes at all to ACR and it is working with no errors for me.