Search Unity

[RELEASED] Game Camera: AAA camera solution

Discussion in 'Assets and Asset Store' started by reindeer-games, Jun 17, 2014.

  1. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,241
    Disabling ScreenBorderMove solved it, thanks!
     
  2. reindeer-games

    reindeer-games

    Joined:
    Mar 5, 2013
    Posts:
    547
    I can add health pickups (without animation) and other stuff, but my only limitation is the animations, I can add only animations which are freely available on asset store. All the character controller is composed from free animations from the store (most of them are from Unity mockup package).
     
  3. reindeer-games

    reindeer-games

    Joined:
    Mar 5, 2013
    Posts:
    547
    Ok, I will test this and let you know.
     
  4. reindeer-games

    reindeer-games

    Joined:
    Mar 5, 2013
    Posts:
    547
    Hi,

    try this, go to file AnimationController.cs and look for line 283, where is

    //ScaleCapsuleForCrouching(); // so you can fit under low areas when crouching

    remove the comment, so it looks like this:

    ScaleCapsuleForCrouching(); // so you can fit under low areas when crouching

    Let me know if it works.
     
  5. reindeer-games

    reindeer-games

    Joined:
    Mar 5, 2013
    Posts:
    547
    Just to let you know what will be in the next version:
    • more independent camera modes (could be possible to remove other cameras without affecting the system), generally more modularity
    • more multiplayer examples, there are still some issues with the camera in multiplayer as some of you wrote before like input ownership, there will be a section about multiplayer in documentation
    • disabling camera when working with UI
    • extending of character controller (health pick ups and maybe more animations/actions)
     
  6. Nachtwind

    Nachtwind

    Joined:
    Jun 3, 2013
    Posts:
    14
    First of all: Welcome back. I know when life comes into the way of projects. So no hard feelings even though my previous posts sound a bit harsh.
    Reading what youre about to update hits the spot of what i am looking for, so i think i am going to wait a bit for you updates - if it happens to be of the same quality as the asset was in the first place i am sure it will be great again.

    Any timeframe for the multiplayer stuff?
     
  7. reindeer-games

    reindeer-games

    Joined:
    Mar 5, 2013
    Posts:
    547
    Hi, the update will take a week, I'll post here when finished. There will be an example multiplayer scene with several characters, with camera and input switching.

    Thanks for feedback!
     
  8. DeanMarquette

    DeanMarquette

    Joined:
    Feb 10, 2015
    Posts:
    165
    Hi, after parenting my own character and parenting the weapon to my character, the weapon nolonger shots using mobile buttons. The weapon will aim but it will not shoot. Please help!

    Also, I'm using the 3rd person mobile button layout. I think it would be better to have the aim and shoot be combined as one button. I do not know why you need two buttons for this. Why would you need to aim without shooting? Let the second button be a zoom in (sniper shot) or better yet weapon switch, or melee attack. As you can see it frees up an extra button you can do anything with.
     
  9. Nachtwind

    Nachtwind

    Joined:
    Jun 3, 2013
    Posts:
    14
    Now that is excellent news. When multiplayer works this sure is an AAA Asset :)
     
  10. reindeer-games

    reindeer-games

    Joined:
    Mar 5, 2013
    Posts:
    547
    Hi,

    the weapon doesn't shoot probably because the weapon controller cannot find it in your model's hierarchy. Can you send me a screenshot of your model hierarchy with the attached weapon? It should be the same as in swat model, same names, otherwise the script will fail to find the weapon model. Or is the shooting not working only on mobile platform?

    Thanks for feedback.
     
  11. DeanMarquette

    DeanMarquette

    Joined:
    Feb 10, 2015
    Posts:
    165
    Hi, I’m using my own character so yes the hierarchy is different. Can you tell me which script and what line I need to look at to make changes, Thanks!

    Also, is it possible for you to do a quick update with the pickups before you do multiplayer? A lot of us won’t be using multiplayer at all and you can probably finish the pickups update in a few hours.
     
  12. reindeer-games

    reindeer-games

    Joined:
    Mar 5, 2013
    Posts:
    547
    It's in WeaponController.cs method InitWeapon. The method is called from Player.cs Start. InitWeapon is looking for the weapon name and muzzle name.

    Sorry, I already did many changes, it will be in one update.
     
    Last edited: Apr 14, 2015
  13. DeanMarquette

    DeanMarquette

    Joined:
    Feb 10, 2015
    Posts:
    165
    Here is my where I put the M4MB in my model. I cant find what to change in the script it just says child.

    https://onedrive.live.com/redir?res...authkey=!ANGoCNarOVc1F_E&v=3&ithint=photo,JPG
     
  14. reindeer-games

    reindeer-games

    Joined:
    Mar 5, 2013
    Posts:
    547
  15. DeanMarquette

    DeanMarquette

    Joined:
    Feb 10, 2015
    Posts:
    165
    After parenting the muzzle it works! THANKS!
     
  16. DeanMarquette

    DeanMarquette

    Joined:
    Feb 10, 2015
    Posts:
    165
    I also figured out how to combine the buttons so I can press aim & shoot at the same time. This is the best asset I've ever bought from the asset store.
     
  17. reindeer-games

    reindeer-games

    Joined:
    Mar 5, 2013
    Posts:
    547
    Great, thanks!
     
  18. swordvision

    swordvision

    Joined:
    May 5, 2014
    Posts:
    1
    I just purchased your asset and I was running a test scene using a demo scene from 3dforge's village interiors. I used your controller. in 3rd preson, I get a
    Screen position out of view frustum (screen pos 720.000000, 365.000000) (Camera rect 0 0 1440 730)
    UnityEngine.Camera:ViewportPointToRay(Vector3)
    RG_GameCamera.CharacterController.TargetManager:Update() (at Assets/GameCamera/Scripts/CharacterController/TargetManager.cs:62)
    when I try to jump sometimes
    Using Unity 5
     
  19. reindeer-games

    reindeer-games

    Joined:
    Mar 5, 2013
    Posts:
    547
    Hi,

    I will test the location. Thanks for the feedback.
     
  20. BYD

    BYD

    Joined:
    Jan 26, 2015
    Posts:
    24
    Hello, I puchased your asset and it works great except everytime I add a new configuration to the ThirdPersonCamera script and play the game a KeyNotFoundException appears and my newly added configuration vanishes...
     
  21. reindeer-games

    reindeer-games

    Joined:
    Mar 5, 2013
    Posts:
    547
    Hi, yes I know about this issue, it will be fixed in the next version, I will be uploading later today...
     
  22. BYD

    BYD

    Joined:
    Jan 26, 2015
    Posts:
    24
    Hurray, thank you very much for your support!
     
  23. reindeer-games

    reindeer-games

    Joined:
    Mar 5, 2013
    Posts:
    547
    A new version was just uploaded to Asset Store, 1.1.9.

    Changes:
    • Camera modes can be removed without dependency errors
    • Better multiplayer support, scene with players switching, more in docs
    • Fixed adding a new camera configuration
    • Health pick-up, docs
    • Disabling of input, useful when pressing onscreen UI buttons, etc, more in docs
    • Bugfixes
    Feedback is welcome.
     
  24. Nachtwind

    Nachtwind

    Joined:
    Jun 3, 2013
    Posts:
    14
    Thank you for the update - seems like Multiplayer is now fine.. but i ran into a different problem. Just wanted to install 1.1.9 freshly on Unity 5 and get an exception when using the installer to get the keybindings:

    Code (csharp):
    1.  
    2. GameCamera import error: C:/BcommanderU5/Battle Commander Prototype/Assets/GameCamera/Content/InputManager/InputManager.install or C:/BcommanderU5/Battle Commander Prototype/Assets/../ProjectSettings/InputManager.asset not found!
    3. UnityEngine.Debug:LogError(Object)
    4. RG_GameCamera.Editor.Installation.GameCameraInstaller:CopyInputManager(Boolean) (at Assets/Systems/GameCamera/Scripts/Editor/Installer/GameCameraInstaller.cs:258)
    5. RG_GameCamera.Editor.Installation.GameCameraInstaller:OnGUI() (at Assets/Systems/GameCamera/Scripts/Editor/Installer/GameCameraInstaller.cs:200)
    6. UnityEditor.HostView:OnGUI()
    7.  
    I tried to locate the file by hand but without success. Also the file is not in the list of imported files when re-importing GameCamera. Am i missing something?

    --------------

    Ok after reinstalling the package a few times it worked.. but right now i have a different problem: No matter waht the character wont move except for rotating when using keyboard input. Mouselook works, yet not in RTS or RPG mode... Tried the sample scenes - does not work there either. Also i reinstalled the input manager through the installer and manually.. that didnt help :/
     
    Last edited: Apr 19, 2015
  25. DeanMarquette

    DeanMarquette

    Joined:
    Feb 10, 2015
    Posts:
    165
    Hi, I updated to unity5, everything seems to work properly but the character now turns its head when I rotate the camera. This is a big problem for me because I need to be able to see the players face when rotating for specific reasons. Can the head rotation be disabled some how?
     
  26. reindeer-games

    reindeer-games

    Joined:
    Mar 5, 2013
    Posts:
    547
    Hi,

    yes, it can, there is an option in Player script, just click on CharacterController object and locate Player script component.
    There should be a boolean value "Look In Camera Direction", uncheck it and it will work.

    Regards.
     
  27. reindeer-games

    reindeer-games

    Joined:
    Mar 5, 2013
    Posts:
    547
    That looks like problem with navmesh, does it show any errors in console like wrong navmesh data? Does the player move in ThirdPerson mode? Really strange that you have problems with the installer, it looks like it completely ignores the installation files, maybe Unity during import ignores those files for some reason, but I haven't seen this issue on my machine yet. Can you try to import GameCamera into new Unity5 project, I mean open Unity 5, create new project and import GameCamera asset. It is possible that the installation files clash with some other files in your asset folder and Unity refuse to install them.

    I am sending you all the files that should be installed during the import, you can try to copy them over if you still have problems:

    Animator ... Content\Characters\Third Person Character\Animator\
    BasicScene ... Content\BasicScene\
    EventsScene ... Content\EventScene\
    InputManger ... ProjectSettings\
    MultiplayerScene ... Content\MultiplayerScene
    ZombieScene ... Content\ZombieScene
    *.unity (demo scenes) ... Content\

    Hope it helps.
     

    Attached Files:

  28. Nachtwind

    Nachtwind

    Joined:
    Jun 3, 2013
    Posts:
    14
    Thanks for the help.. I created a new project and imported GC freshly from the Asset Store and it worked..

    Now for the main project it keeps staying pretty weird. I tried what you suggested earlier with the same files from the working new project and now again with the files you sent.. unfortunately that didnt work...

    Two observations i had though. When trying to import GC the log is cluttered by Information about conflicting UUIDs and every time i run my prototype in unity the installation prompt as well as the unity5 upgrade prompt turn up. No matter what i click they come up again. I doublechecked that the files are copied that the Install scripts wants to copy..
    Oh.. also the Figre keeps this "Arms wide open" pose all the time.


    A picture tells more than a thousand words.. and a video is more explainatory even:
     
    Last edited: Apr 19, 2015
  29. DeanMarquette

    DeanMarquette

    Joined:
    Feb 10, 2015
    Posts:
    165
    Hi, can we get an enemy prefab that shoots back?
     
  30. reindeer-games

    reindeer-games

    Joined:
    Mar 5, 2013
    Posts:
    547
    That is really strange, the "arms wide open" (T-Pose) is caused by missing animations or messed up Mecanim animator tree, could you please check the animator, it should look like this (click on character controller and open Animator window):

    Mecanim.png

    Also please check that all the animations in Content/Characters/Third Person Controller are there, compare with the fresh Unity 5 install (import into a new project).

    Sorry for problems.
     
  31. Nachtwind

    Nachtwind

    Joined:
    Jun 3, 2013
    Posts:
    14
    Ok.. did a bit more research... the odd thing that is happening could be traced somewhat to a certain point. The CharacterController sets the Avatar to null when the game starts running.. and i dont see the reason why.. maybe that helps a bit.

    Video:
     
    Last edited: Apr 20, 2015
  32. reindeer-games

    reindeer-games

    Joined:
    Mar 5, 2013
    Posts:
    547
    Good find! That definitely helps to find the problem, I'll play with the Character and make sure it won't happen again.
     
    Nachtwind likes this.
  33. reindeer-games

    reindeer-games

    Joined:
    Mar 5, 2013
    Posts:
    547
    Sorry, there is no shooting AI at the moment, only zombie and worm.
     
  34. DeanMarquette

    DeanMarquette

    Joined:
    Feb 10, 2015
    Posts:
    165
    Hi, how can I enable "look in camera direction" only when aiming?
     
  35. reindeer-games

    reindeer-games

    Joined:
    Mar 5, 2013
    Posts:
    547
    Hi, I was looking at the problem with avatar and I think you should just re-save the project. Open you scene and before you press play (in editing mode), remove the avatar from character, add it again and save the scene and project. Than try to play the game. I found that Unity sometimes show stuff in the inspector incorrectly, it shows it's there but in reality it's not.
     
  36. Nachtwind

    Nachtwind

    Joined:
    Jun 3, 2013
    Posts:
    14
    I tried this back and forth but it didnt help :/
    I just saw that when i was reverting the avatar to the prefab state it went "missing" maybe i should just completely remove every trace of gamecamera and start over with it... i tried that before though.. but something just must work. i know your asset works and i know its great... and it worked on this project before upgrading..
    *edit*
    Thinking about "upgrading" mind to send me a pm with a download link to 1.1.8 just to verificate this has nothing to do with the 1.1.9 changes?
     
  37. DeanMarquette

    DeanMarquette

    Joined:
    Feb 10, 2015
    Posts:
    165
    Do you think I can just swap the player script from Unity4 with the player script from the Unity5 version? When I uncheck the ‘look at camera’ the player no longer aims when he shoots however, in the Unity4 version there is no ‘look at camera’ and the player can aim while he shoots. I really need this because there are scenes where the camera rotates and zooms in to the players face but the Unity5 version twist the players head backwards and if I uncheck ‘look at camera’ the player no longer aims.
     
  38. reindeer-games

    reindeer-games

    Joined:
    Mar 5, 2013
    Posts:
    547
    Hi, sorry for problems. I think it turns head in Unity 5 because in Unity 4 it was a *pro* feature and now it is free with personal edition. But we can fix this problem in the script, you can go to file AnimationController.cs and look for function:

    void OnAnimatorIK(int layerIndex)

    and comment everything inside, so no code is called, and enable back the LookInCameraDirection. It will work like before.
     
  39. DeanMarquette

    DeanMarquette

    Joined:
    Feb 10, 2015
    Posts:
    165
    Perfect! Thanks, I'll be showcasing my new mobile project I made using game camera exclusively in the next coupe of weeks.
     
  40. reindeer-games

    reindeer-games

    Joined:
    Mar 5, 2013
    Posts:
    547
    Great, good luck with your game!
     
  41. DeanMarquette

    DeanMarquette

    Joined:
    Feb 10, 2015
    Posts:
    165
    What happened to the zombie attack? I dont see it in the animator controller he just runs into you and you get hurt but no animation plays.
     
  42. reindeer-games

    reindeer-games

    Joined:
    Mar 5, 2013
    Posts:
    547
    There is no Zombie attack, all the zombie animations are freely available from the asset store, I haven't found any free zombie attack and I cannot use the commercial ones. If you are interested in additional animations, you would have to buy them from the store and extend the zombie.
     
  43. zhuchun

    zhuchun

    Joined:
    Aug 11, 2012
    Posts:
    433
    Hi, I'm building a RTS game for mobiles, another asset called Easy Touch handling all gestures and events(like OnPitchIn() etc.)
    So I want to control the game camera from scripts but the doc didn't explain much about it.
    Any script reference help? Thank you
    -----------------------------------------------------
    Code (CSharp):
    1. //What I want to do
    2. public void OnPitchIn(gesture g){ //ET event trigger
    3. GameCamera.ZoomIn(g.deltaPitch); //I guess there're something like this
    4. }
    5.  
    6. public void OnDrag2Fingers(){} //other calls etc.
     
  44. reindeer-games

    reindeer-games

    Joined:
    Mar 5, 2013
    Posts:
    547
    Hi,

    thanks for using GameCamera!

    I am just working on custom input feature, I will be uploading in 2 days, please hold on. Current implementation of camera works only with camera input presets. Update will include custom input preset, where you will be able to do what you want to do now, docs will be updated as well.
     
  45. tra2002

    tra2002

    Joined:
    May 11, 2011
    Posts:
    142
    Purchased this earlier today to save time and this package is great. The only issue I really have is the sliding on angled ground but I was able to make a quick work around for now and later will add some checks and fix it properly. Below is what I did just to keep the character from sliding but the idea fix would be to get the angle of the ground and do a check if you want the player to be able to walk on/stand ect.

    AnimationController.cs

    Code (CSharp):
    1. private void SetFriction()
    2.         {
    3.             if (onGround)
    4.             {
    5.                 // set friction to low or high, depending on if we're moving
    6.                 if (input.camMove.magnitude < Mathf.Epsilon)
    7.                 {
    8.                     // when not moving this helps prevent sliding on slopes:
    9.                     GetComponent<Collider>().material = advancedSettings.highFrictionMaterial;
    10.                     GetComponent<Rigidbody>().constraints = RigidbodyConstraints.FreezePositionX | RigidbodyConstraints.FreezePositionZ | RigidbodyConstraints.FreezeRotationX | RigidbodyConstraints.FreezeRotationZ;
    11.                 }
    12.                 else
    13.                 {
    14.                     // but when moving, we want no friction:
    15.                     GetComponent<Collider>().material = advancedSettings.zeroFrictionMaterial;
    16.                     GetComponent<Rigidbody>().constraints = RigidbodyConstraints.None | RigidbodyConstraints.FreezeRotationX | RigidbodyConstraints.FreezeRotationZ;
    17.                 }
    18.             }
    19.             else
    20.             {
    21.                 // while in air, we want no friction against surfaces (walls, ceilings, etc)
    22.                 GetComponent<Collider>().material = advancedSettings.zeroFrictionMaterial;
    23.                 GetComponent<Rigidbody>().constraints = RigidbodyConstraints.None | RigidbodyConstraints.FreezeRotationX | RigidbodyConstraints.FreezeRotationZ;
    24.             }
    25.         }
     
    Last edited: Apr 26, 2015
  46. zhuchun

    zhuchun

    Joined:
    Aug 11, 2012
    Posts:
    433
    Thanks, it's really important :)
     
  47. reindeer-games

    reindeer-games

    Joined:
    Mar 5, 2013
    Posts:
    547
    Thanks for sharing the code, I'll integrate it into the asset.
     
  48. reindeer-games

    reindeer-games

    Joined:
    Mar 5, 2013
    Posts:
    547
  49. DeanMarquette

    DeanMarquette

    Joined:
    Feb 10, 2015
    Posts:
    165
    For us non-coders can you maybe add some more keyword inputs? I was able to make the crouch button by just adding a button and naming it crouch. It would be awesome if you did a few more presets like this. Such as switch weapon, melee attack, action, zoom in, etc...
     
  50. zhuchun

    zhuchun

    Joined:
    Aug 11, 2012
    Posts:
    433
    COOOOOL!! Very efficient support :D
    I just try the zoom function and it works good. I will try more others and feedback here.
    *I made a typo "pitch" :p

    Here's a test script for Easy Touch.
    Code (CSharp):
    1.  
    2. public class GameCameraHelper : MonoBehaviour
    3. {
    4.     public float pinchSpeed;
    5.     float pinchAxis;
    6.  
    7.     void Update ()
    8.     {
    9.         RG_GameCamera.Input.InputManager.Instance.ResetInputArray ();
    10.         var _input = RG_GameCamera.Input.InputManager.Instance.GetInputPresetCurrent () as RG_GameCamera.Input.CustomInput;
    11.         if (_input) {            
    12.                 _input.OnZoom (pinchAxis);
    13.         }
    14.         Flush ();
    15.     }
    16.     /// <summary>
    17.     /// ET pinch triiger
    18.     /// </summary>
    19.     /// <param name="deltaPinch">Delta pinch.</param>
    20.     public void OnPinchIn (float deltaPinch)
    21.     {
    22.         pinchAxis = LengthToAxis(deltaPinch);
    23.     }
    24.  
    25.     /// <summary>
    26.     /// ET pinch trigger
    27.     /// </summary>
    28.     /// <param name="deltaPinch">Delta pinch.</param>
    29.     public void OnPinchOut (float deltaPinch)
    30.     {
    31.         pinchAxis = LengthToAxis(-deltaPinch);
    32.     }
    33.  
    34.     /// <summary>
    35.     /// Reset vars, this can stop the gesture asap
    36.     /// </summary>
    37.     void Flush ()
    38.     {
    39.         pinchAxis = 0f;
    40.     }
    41.  
    42.     /// <summary>
    43.     /// EasyTouch reutrn deltaPinch in pixels and OnZoom() use the axis range[-1,1], so we have to make it smaller.
    44.     /// </summary>
    45.     /// <returns>The to axis.</returns>
    46.     /// <param name="pixels">pixels.</param>
    47.     float LengthToAxis(float pixels){
    48.         return pixels*pinchSpeed*0.01f;
    49.     }
    50. }
    51.  
    52.  
     
    Last edited: Apr 28, 2015