Search Unity

Camera Controller Release

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

  1. Shawn67

    Shawn67

    Joined:
    Jan 2, 2014
    Posts:
    2,196
    Ok.. So this is on a Windows 7-64 machine running Unity 5.1.3, ORK 2.5.5, ACR 2.02, and MC2 v2.06.

    I have made NO code changes to MC2 or ACR. These are straight off the asset store versions. I installed and configured MC2 first and made sure ORK still worked with the Oribit Camera out of the box. Everything worked fine. MC was setup using the MMO Style movement, but it shouldn't make a difference. Below is how my Elf prefab looks as the game is running. In my prefab, both Input Source and Camera Rig fields are empty with the Find box checked. There is a warning in the inspector, as you can see here, while game is playing but I ran around with the character with no problems at all.

    ORKTestOotiiMC2.jpg

    After verifying things worked with the Orbit Rig, I installed ACR. I dragged my Input Source from hierarchy to my rig since my camera is actually part of the scene, but left Anchor blank. Here you see my character in game with the settings of Adventure Rig. The Elf(Clone) is not a static member of the hierarchy but spawned in game using the ORK Spawnpoint (which is actually hidden in the view since it is a child of one of my areas of interest in the scene)..

    Elf(Clone) was added automatically with no extra code changes and as you can see, no errors on the console.

    ORKTestOotiiACR.jpg
    The only thing I can think is maybe the ORK Framework settings are off? Below is how my Game Controls looks.

    ORKFrameworkBaseControlGameControls.jpg

    Like I said, the only errors I'm getting are warnings on the ACR inspector window (but it goes away when unity is in play mode) and the warnings you see in the MC windows. But everything runs fine. One thing I just noticed is on my camera, at some point I ended up checking the From Root box. I'm not sure if there were issues with ORK finding the actual camera and wasn't finding ACR since the rig object was the camera's parent object or what.. But wonder if maybe that is the issue?
     
  2. Alardaen

    Alardaen

    Joined:
    Aug 29, 2010
    Posts:
    85
    Right now I´m using the Custom Player Controller I made, I still need to map all the animations the Character I´m using to the Motion Controller and it will take a while and I wanted at least to get ACR up and running without any issues.

    Thanks again, yes the "From Root" check is needed since the "real" Camera is child of the CameraRig object. I will start now the MC implementation. ;)
     
    Last edited: Dec 20, 2015
  3. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,222
    @Shawn67 and @FargleBargle , Thanks so much for helping. Unfortunately, ORK is just one of those assets I don't own. :(
     
  4. Shawn67

    Shawn67

    Joined:
    Jan 2, 2014
    Posts:
    2,196
    What you might want to try is go ahead and install the updated MC. I'm pretty sure they share some Framework files. Maybe with the updated MC at least installed it will start magically working even though you don't have MC setup on the character yet. I messaged Tim about this in our beta conversation, but my thoughts are if the base camera framework file was updated in MC, the changes may not have made it to the ACR package. At least that would be what I would try at this point. Like I said, I pulled both MC and ACR into my scene and they both are working fine with ORK. So MC might be the missing link for you. I'll work with Tim and help him get vanilla ACR without MC working with it too. But hopefully since you own MC, installing it will get you up and running. :)

    Np.. Like I said in beta convo, feel free to toss anything you need tested my way and we can try to get things ORK ready for you!
     
  5. Alardaen

    Alardaen

    Joined:
    Aug 29, 2010
    Posts:
    85
    :) There is a free version in the ORK Framework site


    Ok I got it working with both ACR and MC2, although I still needed to add some code to reset the Camera localPosition after the Battle Event (since the Camera Change step seems to not find the child Camera), now works on hand into adding the custom animations.
     
    Last edited: Dec 20, 2015
    Tryz likes this.
  6. mdotstrange

    mdotstrange

    Joined:
    Sep 23, 2013
    Posts:
    211
    What would be the easiest way to switch the players ability to control/rotate the camera on and off?

    For example when the player enters a cave I want to lock the camera's pitch/yaw so they can't adjust it using the right analog stick

    I can get it to do just that if I use the yaw/pitch min/max to constrain the rotation but if I touch the right analog stick when doing this the camera stops working and I get this error


    Any tips? thanks!

    BTW I'm using an older version of the IndAdventureRig script with the "standard mode" and "sync yaw" switches you helped me with so I could do a quick turn-
     
  7. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,222
    Just to clarify, you're not using the current camera at all... right?

    For that error, what's the line number you're getting that error at?
     
    mdotstrange likes this.
  8. mdotstrange

    mdotstrange

    Joined:
    Sep 23, 2013
    Posts:
    211
    Thanks for the quick reply! Correct- I'm using a modified older version of the script -

    Here's the error info

    And here's the those lines of code from the script
    507: PostControllerLateUpdate();
    522: ApplyMovement();
    706: transform.position = mNewRigPosition;

    Edit: I just got it to work by changing the pitch min/max with a trigger event :) Thanks for your time!
     
    Last edited: Dec 24, 2015
  9. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,222
    hahaha... Well... ummm... I'm glad I could help. :rolleyes:
     
  10. ThunderTruck

    ThunderTruck

    Joined:
    Sep 25, 2013
    Posts:
    61
    ... Continue from MountPoint thread...
    It's possible change the zoom by moving the camera without a lot modification of the code?
    Otherwise I can use un other system for the camera, but prefer use yours since it is well integrated with
    Motion Controller
     
  11. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,222
    Unfortunately, I don't have an implementation that zooms by moving the camera. There's just too many hurdles when it comes to obstacle avoidance.

    You could implement that if needed and simply disable the FOV zooming. You'd just have to manage the camera position yourself.

    I know you mentioned distortion on the other thread, but typically that only happens as the FOV reaches 1 or zero. As long as you keep it above that, you should be fine. I set the default to 20 and I don't notice any distortion... but maybe my eyes are old. ;)
     
  12. ThunderTruck

    ThunderTruck

    Joined:
    Sep 25, 2013
    Posts:
    61
    Thanks,
    I know quite well the camera technical, I am an amateur photographer.
    It's also a rule of photography move the camera to get the perfect shot.
    Then I need to act on FOV and move the camera to get shots with DOF that I wanted.
    Also I need wider visuals...
     
  13. FargleBargle

    FargleBargle

    Joined:
    Oct 15, 2011
    Posts:
    652
    @ThunderTruck: As someone who often gets caught up trying to make everything in my game "real", I've got to always remind myself it isn't. While real world photography experience can be useful, you're not bound by the physical limitations of real camera hardware here. This is all computer generated imagery. You can zoom as far as you want without worrying about lens issues, and in fact need to add such things as camera effects if you want to simulate them. I constantly need to remind myself not to insist on too much realism under the hood, and instead go with what looks real, even when I need to fake it.

    As for zooming, the FOV approach actually sounds more like what a real zoom button on a camera would do anyway. Preserving the FOV by moving the whole camera forward and back in the real world would involve picking the camera up and moving it (ie. your character would move with it), or putting it on a giant telescoping selfie stick, or more likely a camera drone. Either of the last two choices might better be served with an external script, either anchoring the camera rig to a secondary movable target when you want to zoom it, or perhaps switching to a different camera altogether. In either case, you'd pretty much need to disable your character from moving while doing it, so he doesn't walk into something or off a cliff, because he'd be blind to his immediate environment. In that case switching to a different camera and controller for the duration might be the best option. Good luck with it. ;)
     
  14. florianbepunkt

    florianbepunkt

    Joined:
    Nov 28, 2015
    Posts:
    45
    Hey Tim,

    I experience a small bug when using the adventure camera together with the "Inventory Pro" asset from the asset store. using each asset on its own is fine. But using them together I get an error – but only when I activate "is Collision enabled" property on the adventure cam rig. Using LOS detection works fine.

    Here's the console ouput.

    NullReferenceException: Object reference not set to an instance of an object
    com.ootii.Cameras.AdventureRig.<TestCollisions>m__103 (com.ootii.Actors.BodyShapeHit x) (at Assets/ootii/AdventureCamera/Code/Cameras/AdventureRig.cs:1547)
    System.Linq.SortSequenceContext`2[com.ootii.Actors.BodyShapeHit,System.Single].Initialize (com.ootii.Actors.BodyShapeHit[] elements)
    System.Linq.QuickSort`1[com.ootii.Actors.BodyShapeHit].PerformSort ()
    System.Linq.QuickSort`1+<Sort>c__Iterator21[com.ootii.Actors.BodyShapeHit].MoveNext ()
    System.Collections.Generic.List`1[com.ootii.Actors.BodyShapeHit].AddEnumerable (IEnumerable`1 enumerable) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Collections.Generic/List.cs:128)
    System.Collections.Generic.List`1[com.ootii.Actors.BodyShapeHit]..ctor (IEnumerable`1 collection) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Collections.Generic/List.cs:65)
    System.Linq.Enumerable.ToArray[BodyShapeHit] (IEnumerable`1 source)
    com.ootii.Cameras.AdventureRig.TestCollisions (Vector3 rAnchorPosition, Vector3 rPrevCameraPosition, UnityEngine.Vector3& rCameraPosition, Single rColliderRadius, UnityEngine.RaycastHit& rCollisionHit) (at Assets/ootii/AdventureCamera/Code/Cameras/AdventureRig.cs:1547)
    com.ootii.Cameras.AdventureRig.RigLateUpdate (Single rDeltaTime, Int32 rUpdateIndex) (at Assets/ootii/AdventureCamera/Code/Cameras/AdventureRig.cs:1268)
    com.ootii.Cameras.AdventureRig.OnControllerLateUpdate (ICharacterController rController, Single rDeltaTime, Int32 rUpdateIndex) (at Assets/ootii/AdventureCamera/Code/Cameras/AdventureRig.cs:1445)
    com.ootii.Actors.ActorController.LateUpdate () (at Assets/ootii/ActorController/Code/Actors/CharacterControllers/ActorController.cs:1020)

    Any idea what's going on?
     
  15. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,222
    I'm looking at the line number and basically it's when I distance sort collisions.

    Does Inventory Pro use colliders? Seems odd that it would only be when that's activated.

    I'll try adding some protection and PM you a file to try.
     
  16. datsun80

    datsun80

    Joined:
    Mar 15, 2015
    Posts:
    13
    Hey Tim,

    We are wanting to use this camera to follow a non player controlled character on screen. Is this possible? I noticed the rig asks for an input source and since this character is not player controlled we don't have an input source. Also, can you tell us what the minimum number of files are needed to run the camera? When we import the asset there are a lot of things. Currently we only imported The AdventureCamera->Code folder and the Framework_v1->Code folder.
     
  17. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,222
    Yeah, the Input Source variable is going to be an issue for you. The reason is that I use that to determine if it's time for the camera to orbit or zoom. I don't check for null around all the places because I just assumed it would be used with a PC.

    There are a couple of options:

    1. Add a test for null at some key points. Basically, search for "mInputSource" in the AdventureRig.cs and test right before I access the variable. There's really only 3 or 4 places were we use properties from the variable.

    2. Create a fake InputSource whose properties and values return meaningless values. This way it won't cause a null error, but it also won't cause orbiting, zooming, etc. If you copy UnityInputSource.cs and rename it to something like EmptyInputSource.cs... I'll bet you can do this in 15 minutes or less.

    AdventureRig.cs and AdventureRigEditor.cs are the core. They, use some include files, but I don't know all off the top of my head.

    I know the following:
    BaseCameraRig.cs
    IBaseCameraRig.cs
    InterfaceHelper.cs
    StringHelper.cs
    NumberHelper.cs

    What you can do is move all the files out of the project except the 2 I just mentioned. Then, as you get errors... put back the ones you need. I'm betting there's 10 or 12 max.
     
  18. mdotstrange

    mdotstrange

    Joined:
    Sep 23, 2013
    Posts:
    211
    Hey Tim-

    What is the proper way to move the camera even closer to the avatar when the camera rig is lower than the avatar? I just want it to move closer to the avatar than it does when the rig is beneath the avatar-

    This is the right part of the code to do that right?
    Code (CSharp):
    1. // As we go over the top or bottom, bring the camera closer to the avatar
    2.                     float lModifierStart = 20f;
    3.                     if (_Pitch.z != 0 && _Pitch.x >= lModifierStart)
    4.                     {
    5.                         mDistanceHeightModifier = 0.8f + (0.2f * (_Pitch.z - _Pitch.x) / (_Pitch.z - lModifierStart));
    6.                        
    7.                     }
    8.                     else if (_Pitch.y != 0 && _Pitch.x <= -lModifierStart)
    9.                     {
    10.                         mDistanceHeightModifier = 0.8f + (0.2f * (_Pitch.y - _Pitch.x) / (_Pitch.y - -lModifierStart));
    11.                        
    12.                     }
    13.                     else
    14.                     {
    15.                         mDistanceHeightModifier = 1f;
    16.                    
    17.                     }
    18.                 }
    I tried tweaking the numbers in the else if part of the code- I can get the camera the right distance but it either goes too low and beneath the floor or too high and above the avatar-

    I'm using an older version of the IndAdventure script- sorry bout that :)

    The script is already adjusting the distance based on camera height which is awesome I'm just trying to get the low angle something closer to an angle like this



    Thanks!
     
  19. Tryz

    Tryz

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

    That should be the right place. I packed the pitch info into the Vector3: x = value, y = min pitch, z = max pitch.

    So, that "else if" (as you mentioned) should be where you can tighten it up. The bottom curve brings the height to 80%. If you want it to get closer (say 60%), you should be able to do something like this:

    mDistanceHeightModifier = 0.6f +(0.4f *(_Pitch.y- _Pitch.x)/(_Pitch.y--lModifierStart));

    I haven't tried it and it's been a long time since I've been to that code, but I believe that's right.
     
    mdotstrange likes this.
  20. mdotstrange

    mdotstrange

    Joined:
    Sep 23, 2013
    Posts:
    211
    Thank you so much Tim, that does it!

    Adventure Camera, even the older version- continues to be the best :)

    I have one more small question before I stop bugging you :p

    What is the proper way you would recommend for leveling the camera?

    Right now I'm doing so by lerping to a Pitch X value of -7.5 - It works, but sometimes it doesn't properly reset the distance to the avatar if I reset when the camera is lower than the avatar- it will reset and the camera will be closer to the avatar than it is supposed to be- as soon as you touch the RStick it snaps the camera back into proper position-

    I tried using ApplyMovement and ApplyRotation after adjusting the Pitch but I can't seem to "refresh" to the proper position- any ideas for me to pursue? Thanks again!
     
  21. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,222
    During the Update() function, some other properties are set (like mDistanceHeightModifier and mIsOrbiting). Those may not be getting set if you go straight to ApplyMovement() and ApplyRotation().

    After setting the Pitch.x, try calling these:
    Update();
    PostControllerLateUpdate();
     
    mdotstrange likes this.
  22. mdotstrange

    mdotstrange

    Joined:
    Sep 23, 2013
    Posts:
    211
    Thanks- got it working!

    In addition to calling those- I had to lerp the mDistanceHeightModifier as well- it was staying at 0.8 or 0.6 or whatever I had set it to until I moved the Right Stick then it snapped to 1- so I just lerped it from its current value to 1 after leveling the camera and now its smooth- thanks again!
     
    Tryz likes this.
  23. Alardaen

    Alardaen

    Joined:
    Aug 29, 2010
    Posts:
    85
    Hello Tim, how does the new camera locking mode works, I can´t find it the manual guide.
     
  24. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,222
  25. Alardaen

    Alardaen

    Joined:
    Aug 29, 2010
    Posts:
    85
    Tryz likes this.
  26. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,222
    haha... Sorry, nothing so advanced. :)
     
  27. Plutoman

    Plutoman

    Joined:
    May 24, 2013
    Posts:
    257
    Were you going to add distance based camera zooming at any point? Just a small request! Having some troubles adding it in where it's smooth..
     
  28. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,222
    Can you explain more? You're the first one to mention it.
     
  29. Plutoman

    Plutoman

    Joined:
    May 24, 2013
    Posts:
    257
    Yeah, I'm actually surprised that I'm the first, I was searching for someone else to have said something. But rather than zoom in and out by changing the FOV, zooming in and out by smoothly adjusting the Anchor Distance (moving the camera back and forth).

    I had it working just fine by changing the Anchor Distance via the mouse scroll wheel, but it's just kinda rough looking. Does really well with the LOS adjustment though and looks quite good, it's just not smooth movement.

    Somewhat in the style of say an MMO..
    Edit: @ 1:20 of the first video, only a 2 second snip.


    - Where the camera moves back and forth, by distance, rather than the FOV changing.

    The idea would be that scroll-wheel just smoothly adjusts the distance factor, rather than the FOV value (kinda like the offset moves smoothly, but I can't seem to get it working with the mouse scroll wheel values well).

    The usage being a character where you are typically say, 3 units from it, but you can also zoom in to view the character as well, close up. Probably not in most modes, but as a cinematic-style orientation. Just couldn't get good dampened movement working, probably doing something wrong.

    I feel like it should be a simple thing - just spring dampened movement towards the target distance. Maybe I simply broke something!
     
    Last edited: May 4, 2016
  30. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,222
    I see. I misunderstood. The word "zooming" threw me off. :)

    I thought you were originally asking about players purposely "zooming in"... like when you have a telescope on a sniper rifle and it has x2 zoom, x4 zoom, etc. In this case, you're trying to look forward. That's what the FOV zooming in the ACR does.

    What I think you're talking about and the videos are showing is the preferred distance the camera is from the character in order to look at the character. For example, you can mimic this by simply dragging the "Anchor Distance" value in the inspector while the scene is playing.

    The thing with moving the camera distance forward is that I do it quickly when LOS intrusion happens. This is similar to what you see in the first video with EQ. Otherwise, the camera throbbing is pretty nauseating... This is what the guy is talking about.

    So, when pushing the camera in... I move the camera quickly. When pulling it back, I do that a bit more slowly. You could manage the Anchor Distance variable outside of the camera. To do that, you really want a target distance that changes the Anchor Distance over time. Don't rely on the mouse wheel values directly as they are way too chaotic (as you're seeing). So, you'll have a target distance that changes based on the mouse wheel and a velocity you use to change the actual Anchor Distance to reach the target. That will create the smoothness you're looking for.

    Whew... so, back to your original question:

    I'm not sure when I'll add it. It seems like a good feature worth putting up on the board, but since you're the first one asking for it and I don't need it for my game... it's not something that jumps to the top of the list. Outside work has picked up a bit too. So, time is tight.

    I'm hoping that what I said above can help you add the feature as an add-on. I'm not sure if you'll run into any other odd behavior, but changing the Anchor Distance property should be a quick thing you can try.
     
  31. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    4,873
    FWIW, I'm one of those who plans to adjust the anchor distance for the camera using the mouse wheel. I want to be able to move from an eye-in-the-sky view all the way forward - skipping through the head - to a first person view. That's what I'm used to, and what I want for my game. I expect it will be necessary to have it in order to accommodate different game situations.

    But I'm not going to worry about it. I'll add it when I have time. ;)
     
    Tryz likes this.
  32. gamemaster-468

    gamemaster-468

    Joined:
    Aug 27, 2015
    Posts:
    24
    Omg! This camera literally has everything I need for my camera in the game I'm working on. If only I had money! XD I'll keep an eye on this asset though. If I get some spare cash, I'll be sure to throw some bucks your way for this camera. Nice work man. :)
     
    Tryz likes this.
  33. Shawn67

    Shawn67

    Joined:
    Jan 2, 2014
    Posts:
    2,196
    Ditto.. That is the behavior I will be going for wheen/if I ever get back to working on my game... lol
     
    Tryz and hopeful like this.
  34. _Eyesgood_

    _Eyesgood_

    Joined:
    Apr 19, 2013
    Posts:
    5
    Tim,

    I am mere moments from purchasing your ACR. While I am wanting all of the features you have in your ACR, I am wondering how difficult is it to enable a first person option? What I am wanting is either a mouse wheel zoom which moves the camera into a first person position, or a key press option to switch the camera to first person. Would doing any of these be possible with your product without breaking the features you have built into it?

    Thanks!
     
  35. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,222
    Hi @_Eyesgood_ ,

    The ACR was really built for third-person. However, you can change the properties of the "targeting mode" to be more in line with a first-person view. I can't promise you won't run into some issues that you'll have to work through, but it should get you close.

    Check out page #9 of the Guide and you'll see the properties available:
    http://www.ootii.com/Unity/AdventureCamera/ACR2Guide.pdf

    These kinds of questions are always tricky. :) With code we can do anything... It's just a matter of how much effort you're willing/able to put into customizing an asset to get exactly what you want.
     
  36. Shawn67

    Shawn67

    Joined:
    Jan 2, 2014
    Posts:
    2,196
    I think this is something important for everyone to understand. And this isn't to the person you are responding to as much as it is everyone reading the thread.

    I have yet to have an asset do everything the way I want it. 95% of the time you will always have to tweak it. Buying an asset is a lot different than hiring someone to code for you. Assets are developed to do as much as possible while still keeping them generic enough so they will work for a wide range of people. This request is closer to scope of the original asset than a lot of requests I see in a lot of other threads. It drives me nuts seeing good assets clogged up with unrelated crap! Tim really does provide great code with his assets that you, or the coder on your team, should be able to easily add in that type of feature.

    Thanks for keeping your assets on point while also making things extensible enough that we are able to do other things with them that may be a bit different than you originally envisioned! :)
     
    TeagansDad and Tryz like this.
  37. _Eyesgood_

    _Eyesgood_

    Joined:
    Apr 19, 2013
    Posts:
    5
    Yep, I am a developer by trade. Without being able to see your code (I can now) I didn't know if you had coded constraints against pulling the camera into 1st person. Using the target mode is actually a great idea. I will give that a try and let you know how that goes. I need 1st person for some aiming functionality. Great work on the product! Thanks for responding so quickly. Cheers.
     
    Tryz likes this.
  38. mdotstrange

    mdotstrange

    Joined:
    Sep 23, 2013
    Posts:
    211
    Hey Tim-

    Need a tip- So my camera's collision works perfectly when things are collided with through normal character movement or through the player moving the camera with the R stick-

    But when the character jumps the camera goes through the colliders-
    Here's a gif with an example
    https://gfycat.com/RepulsiveDopeyBedbug

    I'm using a CharacterMotor script for the jump- I tried putting the cam script lower in the script execution order but that didn't help- any tips as to how I would fix this? Thanks!
     
  39. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,222
    This is actually by design. I figured a video would explain it best...



    One other thought...I way prefer line-of-sight collisions to standard collisions. So, that may be something to check.
     
    Last edited: Jun 1, 2016
    mdotstrange likes this.
  40. mdotstrange

    mdotstrange

    Joined:
    Sep 23, 2013
    Posts:
    211
    Thank you so much for the detailed explanation in the video Tim- Yes it totally makes sense- I'll screw around with the anchor point and see what I kludge together :)
     
    Tryz likes this.
  41. Obsurveyor

    Obsurveyor

    Joined:
    Nov 22, 2012
    Posts:
    272
    I don't know if it's a Youtube mistake or what but this video is cropped and limited to 480p. It doesn't really affect the content of the video, except when you refer to the cut off camera view.
     
  42. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,222
    hahaha... yeah, I just did a tiny video to help the other poster.

    I noticed the right side wasn't in the frame, but figured it didn't really affect what I was trying to show.
     
  43. mdotstrange

    mdotstrange

    Joined:
    Sep 23, 2013
    Posts:
    211
    Just wanted to say that I recently upgraded to the newest version from an older one and wow! The newest version is soooo smooth! The camera collision handling is perfect :)

    Thanks so much for the awesome upgrades- if anyone is reading this and looking for a third person camera- buy this one! Its the best one!
     
    FargleBargle, Shawn67 and Tryz like this.
  44. datsun80

    datsun80

    Joined:
    Mar 15, 2015
    Posts:
    13
    Hey Tim,

    Any chance on adding support for touch? I really like the camera but using it on a mobile phone is not the greatest. I tried to emulate a mouse click with a finger press using Unity's CrossPlatformInputManager and then updated your controller to use the CrossPlatformInputManager. While it worked, it was not very polished. Just rocking my finger side to side for instance caused the camera to move back and forth. Expected behavior would be when I touch the screen and drag, the camera rotates around the player (Just like in Pokemon GO). Pinch to zoom is also on my list but I need to get the drag to rotate working smoothly first.
     
  45. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,222
    I haven't dealt with touch devices, but you could just create a "Touch Input Source". You shouldn't have to modify the camera rig code directly.

    Let this new input source trigger an action like zoom or set the values for ViewX and ViewY.

    Check this video out. The video talks about using Input Sources with the Motion Controller, but it's the same exact thing for the Adventure Camera (and all my assets).



    You'd just fill in the ViewX and ViewY properties of your new "Touch Input Source". They cause the camera to rotate. To trigger actions, you'd fill out the IsJustPressed() functions based on tapping.

    I'll add creating a "Touch Input Source" to my list, but it's not very high up there. I know others created a "Rewired Input Source" and I put it on the Vault. If you tackle the Touch Input Source, I can answer questions and put it on the Vault as well.
     
    Last edited: Aug 30, 2016
  46. datsun80

    datsun80

    Joined:
    Mar 15, 2015
    Posts:
    13
    I think I was trying to make it more complicated than it needed to be. I was able to accomplish the movement quite simply.

    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3. using com.ootii.Input;
    4.  
    5. public class TouchController : UnityInputSource {
    6.     float viewX = 0f;
    7.  
    8.     public void Update() {
    9.         if (Input.touchCount > 0 && Input.GetTouch (0).phase == TouchPhase.Moved) {
    10.             viewX = Input.touches [0].deltaPosition.x;
    11.         } else {
    12.             viewX = 0f;
    13.         }
    14.     }
    15.  
    16.     public override float ViewX {
    17.         get {
    18.             return viewX;
    19.         }
    20.     }
    21.  
    22.     public override float ViewY {
    23.         get {
    24.             return 0f;
    25.         }
    26.     }
    27. }
    Now I just have to write the pinch to zoom. I didn't see anything in your input interface that would control a zoom in and out. I assume I will have to talk directly to the adventure rig class for that?
     
  47. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,222
    Awesome. That's great!

    If you look on the ACR inspector's advanced tab, you'll see an action alias for "FOV Action Alias". You can change this value, but I think the default is "Mouse ScrollWheel". That value is the amount of scroll (positive and negative) to zoom.

    So, you can hi-jack that value and do something like this in your new file:
    Code (CSharp):
    1. public override float GetValue(string rAlias)
    2. {
    3.     if (rAlias == "MouseScrollWheel")
    4.     {
    5.         // return your value here
    6.     }
    7.  
    8.     return 0f;
    9. }
    In the middle, you'll probably use the pinch value you have from the touch device... or what ever you want.
     
  48. angelodelvecchio

    angelodelvecchio

    Joined:
    Nov 15, 2012
    Posts:
    170
    This asset camera is marvelous!.

    I Would like to ask you something, is possible to setup, for camera to rotate automatically with the player ? i mean, if i use the left analog to rotate player transform, the camera to rotate in the same way, instead of using the right analog to do it ? is possible?. because, would be nice to keep it as is for the outside part of the level, but when the player is inside a mansion or other tight facilities for example, would be nice to change camera style to fit suspense/horror mode, like in resident evil 4/5 game.

    Thanks
     
  49. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,222
    Hi @angelodelvecchio , thanks for that.

    You can, but it take a little code.

    If you add this to your character code and call it every frame, the camera will stay rotated to the direction of the character (for that frame):
    Code (CSharp):
    1.                 // If we have a camera, rotate it towards the character
    2.                 if (_ForceViewOnInput && mMotionController.CameraRig is BaseCameraRig)
    3.                 {
    4.                     ((BaseCameraRig)mMotionController.CameraRig).FrameForceToFollowAnchor = true;
    5.                 }
    I use it in some of my other assets to force the camera to face the direction of the anchor/character. The "_ForceViewOnInput" is a variable I use to enable/disable the feature in my character.

    I actually have some ideas for a different camera setup that would do this much easier, but it's a ways off. :(

    Let me know if this helps. If you want to email tim@ootii.com, I can help you with your specific case if needed.
     
  50. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,222
    Adventure Camera & Rig 3.0 is coming!

    In truth, it's really becoming the "Universal Camera Controller". However, I can't see putting it out as a new asset and making existing users have to pay.

    This new version of the camera has all the features of ACR 2.0, but allows you to setup different "camera motors" to drive the camera. This means it supports first-person games, third-person games, strategy games, MOBAs, splines, etc.

    It also has the ability to transition from one camera state to the next. Meaning you could have a camera that follows a spline and ends in a third-person view.

    Another free update for ootii customers. :)