Search Unity

Master Camera: Scroll/Zoom, Strafe, FPS-3PS Toggling, Minimal/No Clipping and More

Discussion in 'Assets and Asset Store' started by tzvier, Dec 8, 2011.

  1. tzvier

    tzvier

    Joined:
    May 20, 2010
    Posts:
    355
    There should be a pdf included in the package. I think the middle mouse button functionality you are looking for would be with the MC.ButtonLook script.
     
  2. MrAdventure

    MrAdventure

    Joined:
    Aug 22, 2012
    Posts:
    28
    Hi tzvier,

    This is getting closer and closer to what I am looking for, thanks! Closer but not finished. :confused:

    First, I can't find the .pdf you're talking about, I looked for it in Explorer, in the editor, and reimported to be doubly sure.

    The only problem I have, and please help, is that when I click my MouseLook button, the view snaps to the angle that the MasterCameraRig is set at. So by default my camera starts at 60 in Smooth → Rotation. When I click, it pops to 0, or whatever angle the MasterCameraRig is set at. I would like it to stay at its current angle, whatever that may be.

    My settings for MasterCameraRig Horizontal and Vertical angles, Min and Max, all match MCButtonLook.

    Now for some notes of what I found out, for others who are trying to setup a click to rotate RTS camera:


    The cameras initial start location is not at the Master Camera object, but at the RTS Setup object. The starting rotation still comes from MasterCameraRig.

    To get middle click mouse rotation I had to do the following:

    On MasterCamera Script on MasterCameraRig, set Camera Rotation Mode to None.

    Add MCScroll to MasterCameraRig for zooming in and out.

    Add MCButton Look to MasterCameraRig for rotating while holding a mouse button.

    If you had previously changed Project Settings → Input to allow for keyboard based rotation, go back and undo that, set it back to Mouse Movement. Trying to have both makes the camera rotate without the MouseLook button being pressed.

    Thanks for the help.
     
  3. tzvier

    tzvier

    Joined:
    May 20, 2010
    Posts:
    355
    MrAdventure, I think we should set up a time where I can see what you've got going on with screen sharing through Google Hangouts or TeamViewer. PM me and we can set up a time.
     
  4. johnb2

    johnb2

    Joined:
    Feb 13, 2013
    Posts:
    44
    tzvier,

    Hello, first of all, great 5 star product and I'll be rating you up in the store later today. I was up and running in no time and achieved the exact controller I was looking for within an hour.

    The only problem I'm having, I'm not sure how to overcome.

    My setup is as follows: skyrim style controller using MasterCameraRig with MCScroll (1st - 3rd controller).
    I've hidden the meshes on: MC.LocationAdjustment - MC.StraferPoint - MC.RotationPoint and MC.Scroller but the Renderers for these Objects still remain.

    My problem:
    When zooming in all the way to the 1st person, and then back out, the camera gets stuck on the way out - on what appears to be the back of the head on the model. At least in that location. This is when the camera is directly behind the head and parallel to the ground. If I tilt the camera up (point it down) it corrects itself. If I have the camera tilted at all, the in and out zoom works perfectly. It only appears to happen when directly behind the head (in and out).

    I've set up a demo webplayer to show my team and this issue exists in the demo. I figure if you need a working example of what I mean you can check it out.

    http://mediarotation.com/controller/

    1. Point the camera directly parallel to the ground.
    2. Scroll in to the head.
    3. Scroll out - this is where you get caught.
    4. Tilt camera down and it works fine, but directly parallel to the ground and you'll see.

    And to conclude my inquiry, I apologize if this has already been answered either here or in your great PDF. I'll admit there may be something I missed.

    Thank you in advance for any help you can provide.
     
  5. tzvier

    tzvier

    Joined:
    May 20, 2010
    Posts:
    355
    Hey johnb,

    Thanks for the purchase! I believe your problem is in the Layers and Layer Masks. Check you make sure that your character and the master camera rig are both on the "Player" layer and that the "Collision Layer Mask" variable of the MasterCamera.js script is set to everything except player and ignore raycast. Try that out, and let me know if you still have issues with it.

    Take care!
    -Tz
     
  6. johnb2

    johnb2

    Joined:
    Feb 13, 2013
    Posts:
    44
    That absolutely fixed it. I had a feeling it might be something in the layers. Since this is a fresh project, I hadn't yet set up a Player layer and on that, viola, fixed. Thank you so much!

    Now I hate to be a bother. Is there a way to strafe that character on A and D rather than rotate? (Not camera strafing - just the character)
    If this is a controller thing and not a camera thing, I don't expect a full lesson on the finer points of coding (I'm more of an artist than coder) but if you've had this question before, I'd love to see a solution or example. I'm looking on my own and hoping to resolve that one thing.

    I realize I'll need strafe animations but for now, just to get him to move side to side instead of RotateTowards would be awesome.

    Let me know if you can help. I've already 5star and wrote a small review on the asset store.
     
    Last edited: Sep 28, 2013
  7. johnb2

    johnb2

    Joined:
    Feb 13, 2013
    Posts:
    44
    I successfully added a PauseScript JS to the controller using a PauseScript from UnifyWiki and combining that with the LockCusror Addon from TZ's MasterCamera's asset.

    1. Grab the JS pause script from here - http://wiki.unity3d.com/index.php/PauseMenu
    2. Add it to the MasterCameraRig
    3. Add the 3rd Person Controller to "Start" in the Inspector.
    4. Open the PauseMenu.js file.
    5. Add this to function PauseGame()
    6. Add this under function UnPauseGame()

    What this does first of all is give you a menu to adjust a few things like viewing Tris and FPS - as well as Game Credits, Quality Settings and other Options.

    But most importantly what it does is:
    a. At start the menu shows and the cursor is present to select a menu option (adjust according to your setup)
    b. On click "Play" game starts and cursor is gone unlocking everything, rotation, player movement, etc. (adjust according to your setup)
    c. On ESC, game pauses, camera rotation freezes, menu opens.

    After playing, hitting ESC toggles open/close of the menu.

    I saw some post in this thread about a Pause Menu. Well this is a good start at least. Enjoy.

    WebPlayer demo of MasterCamera + Pause Menu - http://mediarotation.com/controller/


    EDIT: Not featured in the demo is removing the ability to scroll/zoom in and out while in the menu.
    Add this below the MasterCamera enable/disable script:

    Basically, any script you want to enable or disabled can be added, just replace the script in quotes with the proper script name.
     
    Last edited: Sep 29, 2013
  8. tzvier

    tzvier

    Joined:
    May 20, 2010
    Posts:
    355
    Hey johnb2,

    Thanks for all the info about pausing. About the character strafing, that would have to do with the character controller which is outside the scope of this asset.

    Let me know if you run into anymore issues.
     
  9. johnb2

    johnb2

    Joined:
    Feb 13, 2013
    Posts:
    44
    I figured it is. So if I seek help on that it's okay to expose the 3rd person controller code? I won't be exposing any of your code.

    Thanks so much for your quick feedback and help. Top notch sir.

    EDIT: Nevermind. I just realized that this asset uses the exact 3PS controller that comes with standard assets. I for some reason though you wrote that too. Forgive my question. I totally missed that. haha.

    Anyway, keep up the awesome work. You saved me tons of work I had no idea how to do.
     
    Last edited: Oct 1, 2013
  10. beelzeboss

    beelzeboss

    Joined:
    Feb 28, 2013
    Posts:
    22
    I have just purchased your camera tools and once imported I am getting an error which is below. I am in Unity 4.2.1

    Assets/Standard Assets/Character Controllers/Sources/Scripts/PlatformInputController.js(5,21): BCE0018: The name 'CharacterMotor' does not denote a valid type ('not found'). Did you mean 'UnityEngine.CharacterInfo'?
     
  11. tzvier

    tzvier

    Joined:
    May 20, 2010
    Posts:
    355
    Hi beelzeboss,

    Thanks for the purchase! That error doesn't have anything to do with MasterCamera. It's part of the standard assets folder. You can try reimporting by going to Assets > Import Package > Character Controller. Hopefully that will resolve the issue.
     
  12. beelzeboss

    beelzeboss

    Joined:
    Feb 28, 2013
    Posts:
    22
    Cheers yeah you are right since it popped up after install I just assumed. I removed the character controller since I am not using it and it fixed the issue

    thanks
     
  13. johnb2

    johnb2

    Joined:
    Feb 13, 2013
    Posts:
    44
    Hi tzvier,
    Just dropping in to let anyone know who might be interested: MasterCamera works very well with Playmaker, which has become very popular on the store.
    Cheers, keep up the great work!
     
  14. sefou

    sefou

    Joined:
    Aug 30, 2011
    Posts:
    287
    Hi tzvier,

    can you convert your plug in C# ?

    Many thanks
     
  15. tomato_comet

    tomato_comet

    Joined:
    Oct 17, 2013
    Posts:
    18
    I tried the demo and have a question. Is it easy/possible to select a gamepad (360 for example) analog stick for the full camera control similar to the mouse control in the demo? Or use a gamepad's R and L trigger buttons to make the camera swing either way?
     
  16. tzvier

    tzvier

    Joined:
    May 20, 2010
    Posts:
    355
    Absolutely, you can set that through the input manager. Go to Edit > Project Settings > Input.
     
  17. tomato_comet

    tomato_comet

    Joined:
    Oct 17, 2013
    Posts:
    18
    Thank you for the reply.

    I should have been clearer. Are those options available with minimal or no scripting required? Analog stick seems simple, but adding trigger controls simultaneously is possible just using input manager? I wish to have analog stick control but also triggers for quick, immediate right and left camera swings.
     
  18. tzvier

    tzvier

    Joined:
    May 20, 2010
    Posts:
    355
    The input manager does not require any scripting. Can you define a "camera swing"? Like a quick 90 degree rotation? You might be able to get that with 2 instances of MCButtonLook.js, one for each swing direction. That would require some investigation.
     
  19. tomato_comet

    tomato_comet

    Joined:
    Oct 17, 2013
    Posts:
    18
    Thanks again. Either a 90 degree instant swing, or full smooth 360 camera rotation. For example, holding L Trigger would smoothly move camera leftward and would keep circling the character until button release. The analog stick would have full camera control, but sometimes the player needs their right thumb for the face buttons so the trigger camera control would be convenient at those times.

    If you've ever played Shadow of the Colossus, that is what I'm after. During battles, the face buttons are used for attacking so the trigger camera controls are useful to rotate the camera when the enemy blocks the view. Auto camera often makes a bad angle so the manual trigger swinging, both gradual or snap 90 degree swings (I'm undecided) are crucial.

    Of course it can't do vertical movement but I like trigger controlled horizontal camera adjustments as useful additions combined with analog full control. At least for my gameplay goal.
     
  20. tzvier

    tzvier

    Joined:
    May 20, 2010
    Posts:
    355
    Ok, I get the picture. I don't think that there is a way to do this with MasterCamera right now, but I will see what I can come up with.
     
  21. tomato_comet

    tomato_comet

    Joined:
    Oct 17, 2013
    Posts:
    18
    Thanks for your rapid response. Once I get further along in my project I'll use Master Camera. Still a great system to start with. I'm sure somehow the trigger control stuff will turn out to be a simple affair.
     
  22. windrunner

    windrunner

    Joined:
    Jun 23, 2013
    Posts:
    9
    Hey tzvier, nice asset you've got there, saved me a good time, I was already going crazy with camera setup... So many failures....

    Of all things, I'm having problems with only bit of positioning, and I think it might not even be that hard to make... I'm probably just missing something.

    What is happening is: I'm using the ThirdPersonShooter preset with a few modifications. What I am trying to achieve is an Over The Shoulder Camera, like Dead Space and Resident Evil (4+). Basically I am trying to achieve something like this:

    http://www.mhvt.net/quicktime/eng/screenshots/games/dead_space_22.jpg
    http://www.mhvt.net/quicktime/eng/screenshots/games/dead_space_12.jpg

    Mostly, what I want to do is send the character to the left side of the screen,leaving most of the middle and right side clear to allow view.

    I worked a bit with the Master Camera and made something similar, however, problems appeared.

    Basically, when I send the MC.LocationAdjustment right to create the right screen position it works, most of the time, however, it clips through geometry, not all, but a few,yes. If I take the MC.LocationAdjustment just a big right (X 0.08 ) it doesn't clip through anything, however, the character is pretty much still on the middle of the screen.

    I shall use a few pictures to show it:

    http://postimg.org/image/qdfoflc87/full/
    http://postimg.org/image/tvrobzd47/full/

    These two pictures describes the first case. The character is pretty much still on the middle of the screen, and if I am, it gets in the way of my view, however, such position won't clip through anything, it will work perfectly, save the position itself.

    http://postimg.org/image/5186hws9z/full/
    http://postimg.org/image/lnpqqzl7r/full/

    These other two have the MC.LocationAdjustment placed more on the right, the position here isn't ideal, but is close to what I would like to have, and the character won't get in the way of my view. However, there is another thing with this position:

    http://postimg.org/image/9kkf3fa5j/full/

    When I get to geometry the camera gets though it, this clipping is bad, specially because I have many corridors and small areas, it clips everywhere.

    The ''best'' way I could find was to position the MC.LocationAdjustment until the camera works as I like, but the clipping is really problematic...

    I would like to know if it is possible right now to make such camera style (Over the Shoulder) with the Master Camera.
     
    Last edited: Nov 11, 2013
  23. tzvier

    tzvier

    Joined:
    May 20, 2010
    Posts:
    355
    Hey windrunner,

    This is fixable. Part of the reason this is happening is that your aspect ratio is very high. The width of the screen vs. the height is huge. What you can do is adjust the 4 MC.Colliders near the bottom of the MasterCamera rig hierarchy. Move them outwards away from the camera sideways. Or if your game is ultimately going to have a different aspect ratio, test with something that is relative. Investigate these options and let me know if you still have issues.
     
  24. windrunner

    windrunner

    Joined:
    Jun 23, 2013
    Posts:
    9
    I adjusted the aspect ratio to a default 16:9 (1024x576), no real change.

    Also tried to move the 4 Colliders around but it changed nothing for me, it clips though geometry the same way, like I didn't even change anything.

    I messed with resolution too, but, also no change.

    For what I have noticed so far, the clipping happens anything I give the camera an offset bigger than X 0.11.

    If you don't mind, after messing a bit with the camera I found the ''optimal distance'' for the camera I want to create. I let the Stats tab on, so the resolution is there.

    http://postimg.org/image/4cvdqk46f/full/
    http://postimg.org/image/5t6w8p73b/full/
    http://postimg.org/image/e4y1w7f3b/full/
    http://postimg.org/image/j2bmhbh2f/full/

    These four represent the camera I want to achieve, it works very well for both idle and aim positioning, leaving most of the view clear. However, there is one big problem.

    http://postimg.org/image/uimmt3kmf/full/
    http://postimg.org/image/9zrqo16p3/full/

    To some extent the camera works, colliding with geometry and adjusting itself, but when clipping happens it is extreme, I can pretty much see the other side of a wall.

    http://postimg.org/image/9zrqo16p3/full/

    I tried to make an empty object and set it as the player, then offset that object, same thing, didn't work... Clips even more :S

    Any other idea?
     
  25. tzvier

    tzvier

    Joined:
    May 20, 2010
    Posts:
    355
    I have sent you a PM. I think we'll have to get together on teamviewer / skype to see if we can find a solution.
     
  26. windrunner

    windrunner

    Joined:
    Jun 23, 2013
    Posts:
    9
    I believe I found the ''solution''.

    For what I understand, what is happening is:

    The Colliders actually ARE working propperly, the camera actually adjusts position to avoid clipping, however, the the character position within the camera' field of view allows for a small clipping through geometry.

    I've spent the entire weekend trying to figure out a way to make it work, but no success at all, until now.

    Using the MCStrafe Addon I managed to actually set up the view I want and, when collision with geometry happens, no clipping because the character is at the center of the field of view when the location resets.

    The ''problem'' is that, if the collision is sure to happen on the right side, the camera will always reset to the center, but to solve that I can just strafe it to left. Works perfectly.

    There is just a few things that I would like to request your help on adjusting here:

    The MCStrafe Addon resets the camera position everytime it collides with something, and that's good in general, but terrible when I want to aim for a long time, I would need to avoid all geometry or keep strafing right and left until I'm done.

    What I would like to know if possible is:

    By default let the character on the middle of the camera, no displacement at all. Then, when I press the Aim Button, make the camera strafe right, that will create the Over The Shoulder camera that I want. With the camera like that I will be able to walk around normally.

    That would be the first part, hold down the aim button and while it is held, keep the strafe position.

    With that working, if the camera collides with anything by default it would reset to the center of the screen, that would work perfectly, however, is not what I really want.

    My idea is: If I'm aiming and the colliders hit a wall, instead of sending the camera to the center of the screen, make it strafe left, keeping the Over The Shoulder camera, and if it collides with anything again, send it to the right side, repeating as long as I'm aiming.

    With the strafing working, all I would need is to, if I release the Aim Button, reset all strafes and send the camera to the middle of the screen.


    Would such a thing be possible with the Master Camera?
     
  27. tzvier

    tzvier

    Joined:
    May 20, 2010
    Posts:
    355
    windrunner,

    If you want to keep the camera over the shoulder all the time, just set both the MC.Strafe input keys to the same value (i.e. "q") and it will automatically flip on collision (or when you hit the key). However if you want centered normally and OTS on aim only, you could try something like this:

    MCAimStrafe.js
    Code (csharp):
    1.  
    2. #pragma strict
    3.  
    4. var Limit : float = 1;
    5. var AimKey : String = "v";
    6. var SmoothSpeed : float = 5;
    7.  
    8. private var mc : MasterCamera;
    9. private var strafeLocation : float;
    10. private var strafeY : float;
    11.  
    12. function Awake(){
    13.     mc = GetComponent("MasterCamera") as MasterCamera;
    14.     strafeY = gameObject.Find("MC.StraferPoint").transform.localPosition.y;        
    15. }
    16. function Update () {
    17.  
    18.     if(Input.GetKeyDown(AimKey)){
    19.         strafeLocation = Limit;
    20.     }
    21.    
    22.    
    23.     if(Input.GetKeyUp(AimKey)){
    24.         strafeLocation = 0;
    25.     }
    26.    
    27.     //Don't let the camera strafer collide through walls.
    28.     if(!(strafeLocation == 0)){
    29.         //Debug.DrawRay(locationAdjustment.transform.position, straferObject.transform.localPosition, Color.green);
    30.         if(Physics.Linecast(mc.locationAdjustment.transform.position, mc.straferObject.transform.position, mc.collisionLayerMask)){
    31.            
    32.             strafeLocation = -strafeLocation;
    33.            
    34.         }      
    35.     }
    36.     mc.straferObject.transform.localPosition = Vector3.Lerp(mc.straferObject.transform.localPosition, (mc.player.transform.TransformDirection(1,0,0) * strafeLocation), Time.deltaTime * SmoothSpeed);
    37.     //reset the y position
    38.     mc.straferObject.transform.localPosition.y = strafeY;
    39.  
    40. }
    41.  
    That will give, what I think you are looking for.
     
  28. windrunner

    windrunner

    Joined:
    Jun 23, 2013
    Posts:
    9
    Hey tzvier, it worked perfectly. No clipping, anywhere.

    Many thanks for your time and attention.

    Oh, BTW, I think you could make that into a preset for an Over-The-Shoulder Camera =)
     
  29. DrewMedina

    DrewMedina

    Joined:
    Apr 1, 2013
    Posts:
    418
    This looks great, does it have any "on rails" rails functionality? I'm looking for the ability for the camera to ride a rail/spline as the plays moves... Like god of warr, knack, crash bandicoot... Maybe in combination with curvy/itween/camera2... Even if it were nodes...
    Also very glad to hear about the playmaker support.
    Thanks!
     
    Last edited: Nov 18, 2013
  30. tzvier

    tzvier

    Joined:
    May 20, 2010
    Posts:
    355
    HeadTrip,

    MasterCamera currently doesn't have any modes for cinematic cameras like you mentioned. It is something that I've considered for a while and will likely look into when I have a reasonable block to time.
     
  31. SeriousRPG

    SeriousRPG

    Joined:
    Oct 21, 2013
    Posts:
    7
    Hi,
    I just replaced my makeshift camera with Master Camera and it works great but I notice a slight 'shimmy' when the character is walking forward. It is kind of like a head bobble. I had set the Player attribute to the Player's hips because when I set it on the overall mesh, the camera appears too low. (I want the camera at his head level. The tutorial I watched had two fields, one for the mesh and one for the hips so I am trying to guess. When it is set to the mesh I don't see this shimmy, just when it is set to the hips.

    Please advise.

    Sandi
     
  32. tzvier

    tzvier

    Joined:
    May 20, 2010
    Posts:
    355
    Sorry for the late response, I was without internet for a while during a move. What you want to do is set the "Player" variable to the mesh or root of the character, and then use the MC.LocationAdjustment to set the height of the camera. Just drag it up to the character's head.

    Hope that helps.
     
  33. Sinha

    Sinha

    Joined:
    Jul 2, 2013
    Posts:
    4
    Hi

    I bought this asset a few days ago. Mostly it works well but there are a few cases where the camera behaves really weirdly. The case is when there is an obstacle between the player and the camera it raycasts and tries to move close to the player, then in the next frame it switches back to its preferred distance and keeps doing this back and forth action forever. I think there is some bug in the logic of moving the camera back to the preferred position. I tried digging into the scroll script but thought if you can help look into this before i waste a lot of time in this.:sad:

    Waiting for your reply n help.

    Thanks
     
  34. tzvier

    tzvier

    Joined:
    May 20, 2010
    Posts:
    355
    Sinha,

    Does this happen against a wall or a very thin object?
     
  35. Sinha

    Sinha

    Joined:
    Jul 2, 2013
    Posts:
    4
    Checking the debug mode and ray cast i see this usually happens when 1 of the collider ray casts hits an obstacle in between camera and player and the other collider raycasts do not see the obstacle. It can be easily reproduced if you place a series of vertical thick bars in the scene with some amount of spacing in between bars and let the player stand on the other side of the bars and camera see the player through the bars.

    Let me know if you need more info.
     
  36. tzvier

    tzvier

    Joined:
    May 20, 2010
    Posts:
    355
    Ok Sinha,

    That's kind of what I thought. So I would suggest either making a solid, invisible box collider around all the bars or adjusting the camera colliders / adding additional camera colliders. Here is a quick tutorial video on the camera colliders. Let me know if that works out for you.
     
  37. Sinha

    Sinha

    Joined:
    Jul 2, 2013
    Posts:
    4
    Ok I am giving it a try. Thanks for the pointers.
     
  38. Sinha

    Sinha

    Joined:
    Jul 2, 2013
    Posts:
    4
    Things are working fine now. There are minor oscillations which i have damped using time delta smoothing so things look fine. Thanks for your help !!
     
  39. treendy

    treendy

    Joined:
    Jun 8, 2012
    Posts:
    5
    Hello Tzvier

    I have just posted a new Thread relating to a question you answered above (i.e. using the right analog control to rotate camera), would be great if you could have a look for me

    http://forum.unity3d.com/threads/22...ht-Analog-stick-control?p=1476930#post1476930

    Let me know if you would prefer me to paste this question here, just thought you would prefer a new thread more relevent to the question

    Kindest Regards
     
  40. tzvier

    tzvier

    Joined:
    May 20, 2010
    Posts:
    355
    I believe that going to Edit > Project Settings > Input > "Horizontal" and "Vertical" > Type and changing Type from "Key or Mouse Button" to "Joystick Axis" and changing "Joy Num" to whatever joystick you want to use should be what you are looking for.
     
  41. kitchen54

    kitchen54

    Joined:
    Nov 7, 2013
    Posts:
    6
    Hello,
    I loved this program but I can't seem to setup a couple of things. I want the camera to follow me from behind but rotate around me when I use the right stick (but stay on the same vertical). I also want it to snap back to position behind me when I press the left joystick button down. Finally, I can't setup first person view for some reason.
    To make matters more complicated I'm using a system that makes the character pivot if the angle you turn is sharp but I can't figure how to make it ignore camera position for that. (when the camera rotates around the player and I run straight it may activate a pivot because it thinks I'm turning a 45 degree angle.

    Can anyone talk me through this?
     
  42. tzvier

    tzvier

    Joined:
    May 20, 2010
    Posts:
    355
    kitchen54,

    It sounds like you'd want to start out with the Camera Rotation Mode in Follow Behind. Then use MCButtonLook addons to address the left and right stick behavior. I'm not really sure what you mean about the character pivot angle. Maybe we could get together over Skype / TeamView and show me what you mean. I'll PM you with my information.
     
  43. RadioactiveXP

    RadioactiveXP

    Joined:
    Nov 6, 2013
    Posts:
    69
    Great Asset!

    How would you set this up so that in First Person Mode you see the characters arms?
     
  44. tzvier

    tzvier

    Joined:
    May 20, 2010
    Posts:
    355
    RadioactiveXP,

    Thanks! Surprisingly, no one has brought up FPS arms before. Currently you'd have to set it up to where the arms are a different mesh than the body and only hide the body with the MCScroll > Mesh Hiding. I'll look into implementing some other options as well.
     
  45. RadioactiveXP

    RadioactiveXP

    Joined:
    Nov 6, 2013
    Posts:
    69
    What do you think about repositioning the First Person camera so that the "lens" is just in front of the chest of the player (taking into account the breathing for example); and then when you switch to FPS mode, re-enable the model so that the camera "sees" it?
     
  46. tzvier

    tzvier

    Joined:
    May 20, 2010
    Posts:
    355
    I don't see why that wouldn't work. You could just set the MC.LocationAdjustment to just in front of the chest/neck/head wherever looks appropriate in first person mode. Then just write a small addon script that re-enables the mesh when the camera distance is at 0 (or less than 0.01).
     
  47. Greg-Bassett

    Greg-Bassett

    Joined:
    Jul 28, 2009
    Posts:
    628
    Hi all, I purchased MasterCamera yesterday to use in my latest iOS game in which I need my camera to collide with walls and adjust the distance accordingly.

    I have managed to get it all set-up reasonably painlessly, and have the camera set to LookAt my target object, however with scroll enabled it works in the editor but not on my iOS device with pinch gesture, any ideas?

    The rotation of the camera works with the drag gesture, however every time I touch the screen to rotate the camera, it always jumps back to the starting position and does not allow me to just keep rotating the camera around?

    Any pointers greatly appreciated...
     
  48. tzvier

    tzvier

    Joined:
    May 20, 2010
    Posts:
    355
    Hey Greg,

    How do you have the dragging/rotation set up? If it's using MCButtonLook, check for the option "Return To On Click." That may be what's tripping it up.

    For the zooming, the MCScroll script is setup to use Input.GetAxis("Mouse ScrollWheel"). I don't think that you can set up the pinch command within the input manager, so you may just change the two lines of code that handle that to use your gesture system. Check out lines 55 and 58 in MCScroll script.

    I hope that helps. Let me know if it works out!
     
  49. Greg-Bassett

    Greg-Bassett

    Joined:
    Jul 28, 2009
    Posts:
    628
    Hi tzvier,

    Thanks for getting back to me, I was not using the MCButtonLook, but I am now as it is actually what I want. This now works in the editor only when I press left mouse button, which is perfect, and with Return To On Click unchecked it works perfect in the Editor.

    Unfortunately when running on the device, it still jumps the camera rotation depending on where on the screen I touch! :-(

    If I touch the same place it pretty much works, but I need to be able to touch anywhere and just carry on the camera rotation, any other ideas?

    I have not tried changing the scroll input, but I think I should be able to get this one sorted following your advice on the line numbers etc...

    Thanks again for your help, any other thoughts on the drag rotation solution would be greatly appreciated! :)
     
  50. Greg-Bassett

    Greg-Bassett

    Joined:
    Jul 28, 2009
    Posts:
    628
    All sorted! :)

    I ended up converting your MCScroll code to C#, and added the collider section of code to my existing gesture code (FingerGestures asset), and added the layermask and the four collider reference objects behind my camera, works a treat!

    Will definitely use MC in my next app though, it is great as an out the box tool, with very flexible options!