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

Realistic FPS Prefab [RELEASED]

Discussion in 'Assets and Asset Store' started by Deleted User, Apr 5, 2013.

  1. Deleted User

    Deleted User

    Guest

    Looks like the problem is with the animations. You can undo the changes you made to WeaponBehavior.cs (delete the comment dashes). There are two things to check:

    First, in the project window, could you please click on the AK47_Anim and MP5_Anim models in !!!Realistic FPS Prefab Files/Models/Weapons/ and then check that in the inspector that the MP5_Anim Import Settings->Rig->Animation Type is set to Legacy?

    Then, in the Hierarchy window, could you select !!!FPS Main/FPS Weapons/MP5/MP5_Anim and on the inspector tab in the animations component of MP5_Anim, expand the Animations arrow? The size should say 3 and the animations below it should be Fire, Reload, and Ready.

    You can also expand the MP5_Anim object in the project window in !!!Realistic FPS Prefab Files/Models/Weapons/ and drag the animations from there (the big icons with an arrow on them) over the small icons with the same name (Fire, Reload, and Ready) in the inspector tab in the animation component->animations list of the MP5_Anim object. That should make sure that the models used in the game are linked to their proper animations.

    Sorry if this has become a bit complicated. I think Unity 4 automatically detects if a model's mesh animations are using the legacy format, but if the MP5 and AK47 models weren't set up correctly, the actions I suggested above should rule that out as your problem. Thanks for your patience.
     
  2. Dari

    Dari

    Joined:
    Mar 25, 2013
    Posts:
    130
    THANKS A LOT!!!
    I have found the right animations (it was hard, all animations have the same names)
    It works great! Thanks for patience with me!
     
    Last edited: Apr 21, 2013
  3. OneShotGG

    OneShotGG

    Joined:
    Nov 16, 2012
    Posts:
    225
    Any idea what is coming with the next release?

    Burst Weapons?

    Bow and Arrow?


    Just curious ;)
     
  4. Deleted User

    Deleted User

    Guest

    No problem Dari, we're glad we could help you get the animations working again.

    Our main focus for new releases is fixing reported bugs and addressing technical requests like the pausing feature we just added. Most of that work is done now and we are getting started on some new additions for the next version. Our priorities for the next version are:

    -Footstep sounds that change for the surface the player is walking on
    -Bullet impact effects that change based on the surface hit (wood, dirt, metal)
    -Make weapons droppable
    -Option to limit amount of guns player has in their inventory
    -Option to limit the time that player can sprint​

    And these features for the next version or future versions, depending on how long it takes to implement them:

    -Prone stance for the player
    -Grenades
    -Melee attacks for equipped ranged weapons (IE pistol whipping)
    -Alternate rigidbody pickup method where the pickup key won’t need to be held down
    -Bow and Arrow mechanics
    -Weapon burst fire (3 round or other number)
    -Player leaning​

    That's the plan at the moment! Let us know if you have any more questions.
     
    Last edited by a moderator: Apr 23, 2013
  5. Unicron

    Unicron

    Joined:
    Sep 28, 2011
    Posts:
    191
    Awesome feature list you have there for the future release, looking forward to it. Also, is it possible to make the object that's picked up a bit stiffer and not have that follow to it when you move around, just like in Half Life or Deus Ex Human Revolution.
     
  6. Dari

    Dari

    Joined:
    Mar 25, 2013
    Posts:
    130
    Great features! The most important following features for me are: (that's what I would suggest :S)

    -Player leaning
    -Bullet impacts/footsteps sounds based on a surface
    -Droppable weapons
    -Sprint stamina
    -Grenades
    -Pause menu

    That's what I like most, I hope that upcoming features are going to be great!
     
  7. OneShotGG

    OneShotGG

    Joined:
    Nov 16, 2012
    Posts:
    225
    Sounds great, this pack really has me excited. Cannot wait for limit to guns and dropable guns. Your possible future features are exactly what I looking for too.

    Question about the dropable weapons, will they require a key press or will it autodrop the current weapon if all weapon slots are full? Also will it be possible to destroy (ie remove) the weapon upon the switch instead of dropping a rigidbody?
     
  8. Deleted User

    Deleted User

    Guest

    Thanks Unicron, for the alternate pickup method, we're going to try a different approach to moving the physics objects which should result in held objects that stay more aligned with the camera angles. The current method is spring-based, which allows the pivot point to be placed anywhere on an object, but is bound by physics traits like drag, angular drag, spring strength, and mass, which makes the held objects move around more. You can try experimenting with the hidden variables in the DragRigidbody.cs script to see if you can get tighter movement in the meantime.

    Thanks, we'll keep you updated!

    Good to hear OneShotGG. What we were thinking was having the weapons require a use/activate button press to pick up and and a drop weapon button press to drop. We can make an autodrop and non-autodrop option selectable from the inspector.

    For your second question, are you asking for an option for the currently equipped weapon to be removed and have the newly obtained weapon take its place? We can add that in addition to the weapon rigidbody dropping option. Thanks for the feedback!
     
  9. OneShotGG

    OneShotGG

    Joined:
    Nov 16, 2012
    Posts:
    225
    Basically I was wondering if it could would work like COD Zombies. Basically, when you "Pick up" a weapon, if you already have the max amount of weapons equiped, it will replace your currently held weapon with the one you "pick up".

    The way you describe it makes it sound like Borderlands 2.

    Honestly, I think you should be able to use the same script for both ways and add a "destroy" bool for the drop weapon script. (If that makes sense).

    BTW, I have a rudimentary spell script working in tandem with your great fps prefab (think Bioshock Infinite). Other than having to learn some C# your asset has kept my imagination speeding along towards something that is materializing as a actual game! (I am better at java since it is similar to Unrealscript which I worked with prior) .
     
  10. lod3

    lod3

    Joined:
    Mar 21, 2012
    Posts:
    671
    @Azuline

    Picked this up this morning. Nice work! Really looking forward to grenades...
     
  11. Dari

    Dari

    Joined:
    Mar 25, 2013
    Posts:
    130
    Azuline,

    You said that you are making Pause Menu and Menu in your game, I'm also trying that, I've got a script from Unity Asset Store but the problem is:
    When I press Escape button it shows GUI Texture but doesn't shows the mouse so I can't click on it, any ideas to fix that?
     
  12. lod3

    lod3

    Joined:
    Mar 21, 2012
    Posts:
    671
    Hi Azuline,

    Loving this package. The exposed fields give a good amount of tweak-ability for someone with no code knowledge (like me). And I'm still lusting for grenades...

    -----

    2 quick questions:

    1.Could you please add the “Hand” functionality from FPSPlayer as a custom field in the Weapon Pickup script? This would allow pickups to each have their own unique icon, instead of everything sharing one. If left blank, it defaults to FPSPlayer.


    2. There any way to have the Player complete a full jump when pressing up against a wall while simultaneously jumping? Currently there’s only 3 options to jump up to an elevated position:

    Running jump, standing jump from away, and a standing jump where you wait for the apex of the jump before pressing forward to reach the elevated position (when pressed against wall).

    In an attempt to allow the Player fast, fluid movement in the environment, this is one of those issues that really breaks the tempo. There any way to allow the Player capsule to do this?

    Thank you.
     
  13. Deleted User

    Deleted User

    Guest

    Sure, an option for destroying the current weapon would be fairly simple to implement and it will be added with the weapon dropping feature.

    Nice job on the spell system! Our asset did use more javascript in the earlier stages, but we switched over to C# because it made made debugging easier for us and supposedly there is less interpretation that Unity needs to to with casting variables and setting vectors. This post pretty much covers all the differences between javascript and C# in Unity. If you have any questions about the C# used in our asset, please let us know.

    Great to hear about your game ideas too. Our intention with this asset was to get the core basics down to allow for quick prototyping and then eventually do a full game. Keep up the good work!


    Thanks! Easy tweak-ability was a top priority. Grenades will be added soon. For your first question, we can definitely add a feature for custom pickup icons in the next version.

    I see what you mean with the player not jumping the full jump height when moving against the vertical surface. This is partly due to friction between the player physics capsule and the world collision geometry. By default we have the player capsule's physics material friction set to 1 with maximum friction combine, which is the highest friction possible. This is done to prevent the player from sliding down slopes like stairs or hills.

    There is some air manipulation allowed when the player jumps. So if you jump from a stationary position, you can jump to full height and move forward while airborne to hop up on objects. We understand what you mean about it breaking tempo though and we will look into a fix for this. Thanks for bringing it to our attention.


    This is likely happening because our SmoothMouseLook.cs script locks the mouse and hides the screen cursor. You could change the SmoothMouseLook.cs script's Update() function to something that looks like this to show the cursor when Time.timeScale is zero and then lock and hide the mouse again when Time.timeScale is a positive value:

    Code (csharp):
    1.     void Update(){
    2.  
    3.         if(Time.timeScale > 0){
    4.            
    5.             //Hide the cursor
    6.             Screen.lockCursor = true;
    7.             Screen.showCursor = false;
    8.            
    9.             if(Time.timeSinceLevelLoad > 1){
    10.  
    11.                 ////mouselook update code////
    12.  
    13.             }
    14.            
    15.         }else{
    16.             //Show the cursor
    17.             Screen.lockCursor = false;
    18.             Screen.showCursor = true;  
    19.         }
    20.        
    21.     }
    Just tested this and it unhides the mouse when paused. This change will also be in the next version too. Hope that answers your question Dari.
     
    Last edited by a moderator: Apr 26, 2013
  14. Dari

    Dari

    Joined:
    Mar 25, 2013
    Posts:
    130
    Okay, thanks alot! :)
    And one question: When are you expecting the new updated version? (I'm just curious)
     
    Last edited: Apr 26, 2013
  15. VenomUnity

    VenomUnity

    Joined:
    Apr 6, 2013
    Posts:
    29
    How can I apply damage to NPC Player. I'm applying DamageCharacter Script but is not working for me. Can you explain more this topic because I couldn't find much info in documentation.
     
  16. lod3

    lod3

    Joined:
    Mar 21, 2012
    Posts:
    671
    That's awesome, Azuline. Looking forward to it!

    So, say I wanted to experiment with it, where could I find that capsule friction value of 1? Might find a sweet medium in the meantime that works for my needs. Thanks again!



     
  17. Kenrod4u

    Kenrod4u

    Joined:
    Apr 8, 2013
    Posts:
    9
    Greetings,

    First off, I just wanted to say that the Realistic-FPS-Prefab is Great! I personally love it... In regards to the FPS Prefab, how do I inflict damage to the FPS? Is there a specific script that I need to incorporate into my AI?

    Please Help... Thanks

    Ken
     
  18. lod3

    lod3

    Joined:
    Mar 21, 2012
    Posts:
    671
    @Kenrod4u

    I believe we are both after the same result (saw your posts in the Advanced AI Pro thread). We're looking to make the projectiles from Realistic FPS Prefab weapons affect characters applied with AI with this package:

    http://forum.unity3d.com/threads/168870-Released-Advanced-AI-Pro-v2-5-Enemy-NPC-Ally


    @Azuline

    Actually came here to see if you would be interested in creating support scripts for popular AI solutions like the one above, as well as the Walker Boys package, etc. I think a lot of users potentially fall into the no-coding category where something like this is immensely useful, not to mention more attractive to get started.

    No idea how involved that would be, but logically for me it seems that all is required is copy/pasting the script responsible for firing/causing damage, and inserting whatever damage type the targeted AI solution's character would be looking for. Well, I hope it's along those lines! ;)

    What do you think?



     
  19. Deleted User

    Deleted User

    Guest

    No problem! As it looks now, the new version will take some time. Maybe a few weeks or more to develop and test. Though the features we listed earlier may be divided into smaller updates depending on how long it takes. We'll definitely keep you informed in the meantime.


    Hi VenomUnity, we apologize that the AI is not discussed in more detail in the documentation. Our priority was describing the workings of the Realistic FPS Prefab, but we plan to update the docs in the future with more information on the other elements of the demo scene.

    Damage is applied to objects and NPC's starting in the WeaponBehavior.cs script. Around line 748 of that script you will find a function called HitObject that sends a message to the hit NPC game object to call their ApplyDamage function.

    In other words, the NPC's take damage in the demo scene because their CharacterDamage.js script has a function called ApplyDamage which is called in WeaponBehavior.cs in the HitObject function. The ApplyDamage call in WeaponBehavior.cs looks like this:

    Code (csharp):
    1.         //Call the ApplyDamage function in the hit object          
    2.         hit.collider.SendMessageUpwards("ApplyDamage", damage, SendMessageOptions.DontRequireReceiver);  
    That line of code scans the script components of the NPC object for a function called ApplyDamage and calls it while also passing the damage amount to it in the form of a floating point argument so the ApplyDamage function knows how much damage to apply to the NPC.

    The NPC object's layer should also be set to layer 13, or the layer named "NPCs" so that the raycast in WeaponBehavior.cs knows to check the NPC game object for a hit.

    As for specifically why the damage isn't being applied to your NPC, it depends on how you have it set up in the scene. First of all, when you try to have the weapons damage an NPC, does the NPC show puffs of smoke where they are hit, but doesn't take damage? Or do you get an error when trying to use the CharacterDamage.js script with the WeaponBehavior.cs script of the FPS Prefab?

    To help us understand your issue better, could please provide some more details about what happens in your scene when you try to get the NPC damage to work? Such as, are you using the original AIs from demo scene, or have you attached the CharacterDamage.js script to a different character? Thanks!


    Thanks Kenrod4u, glad you're enjoying the FPS Prefab! Inflicting damage upon the FPS player is very similar to the method that I described above about applying damage to NPCs. The code that handles player health and damage is located in the FPSplayer.cs script. Around line 363 of FPSPlayer.cs there is a function called ApplyDamage which uses a floating point argument called damage to determine the amount of damage to inflict upon the player.

    The ApplyDamage function of FPSPlayer.cs works in much the same way as the NPC ApplyDamage function, but this time, the code is located in the Gun.js script of the enemy NPC which looks like this:

    Code (csharp):
    1.             // Send a damage message to the hit object         
    2.             hit.collider.SendMessageUpwards("ApplyDamage", Random.Range(damage + 5, damage - 5), SendMessageOptions.DontRequireReceiver);
    This line of code scans the player game object with the collider that was hit by the Gun.js script for a function called ApplyDamage and calls that function using the damage floating point argument as the damage amount.

    So to inflict damage upon the player, you would call the ApplyDamage function in FPSPlayer.cs using code similar to the above SendMessageUpwards method in the section of your AI script that sends damage notifications to other objects like the FPS player. Hope that answers your question.


    Well, it turns out that friction wasn't the only issue. Apparently the player collider was overlapping into the world collision colliders in between fixed updates. I've worked on this problem a bit and I think I've found a solution that makes for smoother jumping against and up onto objects.

    You can compare these two web player builds to see for yourself:

    Realistic FPS Prefab 1.16 (original movement code)


    Realistic FPS Prefab 1.17a Development Build (new movement code)


    In 1.17a you can test the new movement code by walking into the white wooden fence near the player spawn and jumping. The player should jump the fence. If you try the same thing in 1.16, the colliders become locked and the player can only jump over the fence by standing stationary and air manip-ing over the fence near the apex of the jump.

    If you still want to experiment with player friction in 1.16, you can edit the Player physics material located in the project library in !!!Realistic FPS Prefab Files/Physics Materials. The new movement code will be included in the next version. Hopefully the wait won't be an inconvenience. Thanks again for pointing out this issue!

    It sounds like it wouldn't be too involved to incorporate calls to the Realistic FPS Prefab's ApplyDamage functions into other packages. All you would need to do is find the code in the AI package where the attack would target the player and paste this code:

    Code (csharp):
    1.         //Call the ApplyDamage function in the hit object          
    2.         hit.collider.SendMessageUpwards("ApplyDamage", damage, SendMessageOptions.DontRequireReceiver);  
    Ideally, it would be that simple. Note that for the above line of code, the AI package's attack method would need to have the target's game object stored in the RaycastHit called "hit" in order to send the ApplyDamage method to the correct game object. If the AI package's attack code identifies the target as a game object, you would just have to change the code to this:

    Code (csharp):
    1.         //Call the ApplyDamage function in the hit object          
    2.         targetGameObject.SendMessageUpwards("ApplyDamage", damage, SendMessageOptions.DontRequireReceiver);  
    As far as having the Realistic FPS Prefab's weapons damage NPCs from other AI packages, the HitObject function of WeaponBehavior.cs would be the place to add the specialized AI package's damage NPC code and/or function call.

    Making a limited-programming-knowledge tutorial or guide on how to use our asset with other AI Packages does seem like a good idea and we will look into it. It just might not be right away, as we are focusing all our energy on the next version of the Realistic FPS Prefab at the moment. Hopefully the info in the rest of this post has shed some light on how to go about this. Please let us know if you have any more questions.
     
    Last edited by a moderator: Apr 29, 2013
  20. Dari

    Dari

    Joined:
    Mar 25, 2013
    Posts:
    130
    Thanks Azuline, I saw the new 1.17a version, what have you done do fix that fence jumping bug?
    And, is there a way so I can open .fbx files from Realistic FPS Prefab (like weapons) to my MAYA?
     
    Last edited: Apr 29, 2013
  21. Kenrod4u

    Kenrod4u

    Joined:
    Apr 8, 2013
    Posts:
    9
    Greetings Lod3,

    In review of the recent threads, I believe we are ! As for my interest in creating support scripts, I am always willing to help anyway I can. Just to give you some background about my interaction with Unity; I just started using it about a Month ago. Like others, my experience have been somewhat of a crash course! However, in the last Month, I will say that I have certainly learned a lot and continue to every day. As for my scripting experience; it has certainly been a challenge. In the begining, I started teaching myself CS and JAVA; however, realized that Unity scripting is Unique. At the moment I am building a FPS game with Zombies and so the challaenge began. In looking at some of the questions you are asking, I would say you are probably where I am at right now. Case Study: we are asking the same questions and experiencing the same errors. I am slowly overcoming the errors by reseaching all ready developed scripts and manipulating them to fit my needs. Let's face it, there is a lot of already developed stuff out there so why recreate the wheel. At the dsame time I am learning! Bottomline: You cannot manipulate a script if you do not know what it is doing... I guess this is a different approach to learning. In any case Lod3, feel free to contact me at kenrod4u@runbox.com if you are looking for a solution or want to share some ideas...

    Best Regards

    Kenrod4u
     
  22. Deleted User

    Deleted User

    Guest

    To allow the player to jump over objects easier, we added a small check for colliders in front of the player and then stop the player's forward motion before they can run into an object. This prevents the player's capsule collider from overlapping the world collision geometry colliders and getting stuck when the vertical velocity of the jump was applied to the player's total rigidbody velocity.

    To answer your second question, you can view the Realistic FPS's .fbx files in Maya by going to file->import and navigating to the .fbx you want to import. Hope that helps.


    Kenrod4u, you make some good points! :)
     
  23. Dari

    Dari

    Joined:
    Mar 25, 2013
    Posts:
    130
    Thanks for your answers, it worked!
    I have created my own weapon and animation (on Unity animation maker, not Maya), now when I put animation on my weapon, it won't work. Please help, thanks alot!
     
    Last edited: May 1, 2013
  24. Deleted User

    Deleted User

    Guest

    Hi Dari, animations created in Unity should still work with the Realistic FPS Prefab. Does the console print any errors when you try to run the scene with your animation? Or does the animation simply not play? The WeaponBehavior.cs script expects the animations to be named either as Fire, Reload, or Ready, and the frame range of your animations need to be defined in the object's import settings in the inspector window. Then your animation should be dragged from the project library into the Animations list of the Animation component of MyWeapon_Anim object. The MyWeapon_Anim object, should be a child of the MyWeapon object, which in turn, should be a child of the FPS Weapons object.

    There is a lot to remember and learn, so I hope that helps. You might want to have a look at the tutorial for adding a weapon in the documentation as well. If you have any more questions, let us know.


    As for applying damage to NPCs that are different than the default robot NPCs included in the demo scene using the Character Damage.js script, we've made some changes to the CharacterDamage.js script which should prevent errors and allow it to be attached to any game object using the NPCs layer and take damage by the Realistic FPS Prefab's weapons. If you want a copy of this script before it is released with the next version, please send a PM.

    Thanks for the feedback everyone, as much as you are learning about the workings of the Realistic FPS Prefab, we are also learning how to better serve our customers. We've recently made some new posts to our blog that cover several frequently asked questions. So that can be a good learning resource as well.
     
    Last edited by a moderator: May 2, 2013
  25. OneShotGG

    OneShotGG

    Joined:
    Nov 16, 2012
    Posts:
    225
    Ok so I promised a video of the spell casting system I am working a while back so here is the first look.

    [video=youtube_share;ICxZaCEXWXA]http://youtu.be/ICxZaCEXWXA

    Right now individual spells(rigidbodies) are placed in an array (PlayerSpells.cs) which is used by the spellcastingsystem.cs to not only indicate what spells a player has, but what keys launch which spells as well. The spellcastingsystem.cs then reads the correct SpellBehavior.cs(lol) to assign the right launch variables, cooldowns, animation delays, etc for each equipped spell.

    Currently the actual spells do nothing but bounce around (and then die) as I haven't gotten to coding effects. Also, the spell animation will play for every weapon in the PlayerWeapons.weaponOrder array but I only have a pistol animation added so far (that's why it looks weird on the machine gun :p)

    Eventually players will setup their spells in a pregame menu (max of 6) and whatever order they want them in will be reflected by the respecting numbers keys (or whatever keys they choose to use).


    You will also notice a weapon with custom animations (yeah they suck, I am no animator!!!). For some reason when I use iron sights with it the bullets always land below where I am aiming (you can see it in the video on the target). Did I do something wrong in Maya to cause this? How can I fix the iron sights?
     
    Last edited: May 2, 2013
  26. lod3

    lod3

    Joined:
    Mar 21, 2012
    Posts:
    671
    @Azuline

    Perfect! Tried jumping out by the new boxes, worked great. Thank you.

    Fair enough. Thank you for posting that info. Please keep me posted :)
     
  27. lod3

    lod3

    Joined:
    Mar 21, 2012
    Posts:
    671
    @Kenrod4u

    Agreed. Hopefully we can find a solution to our needs shortly. I have a good feeling...
     
  28. Dari

    Dari

    Joined:
    Mar 25, 2013
    Posts:
    130
    Thanks Azuline, animations works fine! But, how can I change the shot direction if it is possible, because when I press RMB to aim then it doesn't aim in the right bullet direction. Also, I read the tutorial and there it says to copy the similar gun as our (in !!!FPS Main > FPS Weapons), I copied MP5 and now the animations that are supposed to be on MP5 they won't work, I mean they want play, it doesn't says any errors. Maybe the problem is: When I go to MyWeapon in FPS Weapons, then click Select next to the Prefab word (upper right corner), it shows the MP5 Prefab. Just one more thing, Reload and Ready animations must be created in Maya? Because I can't move the hand in Unity.

    Thanks for your patience! :)
     
    Last edited: May 2, 2013
  29. Deleted User

    Deleted User

    Guest

    Nice work OneShotGG! The spell casting animation and the system you've created look great so far.

    The iron sights can be fixed in the Unity editor by modifying the Weapon Zoom XPosition and Weapon Zoom YPosition vars of the weapon's WeaponBehavior.cs script component so that the iron sights line up with where the bullets are hitting in the scene. If you temporarily disable the code in FPSPlayer.cs around line 244 that hides the crosshair when the sights are raised, you can actually tweak the Zoom Position variables so the gun sights line up with the crosshair to get accurate sights. Here's the change to the script to make:

    Change this:

    Code (csharp):
    1.         //enable and disable crosshair based on various states like reloading and zooming
    2.         if(IronsightsComponent.reloading || zoomed){
    to this:

    Code (csharp):
    1.         //enable and disable crosshair based on various states like reloading and zooming
    2.         if(IronsightsComponent.reloading /*|| zoomed*/){
    ...to allow the weapon sights to be calibrated to the crosshair position. It would also be possible to modify the weapon firing raycast to always fire to where the gun is pointing, which would be useful for a dead zone aiming setup. Currently by default, the weapon fires in the middle of the screen so the crosshair will be accurate. Hope that helps and keep up the good work!


    No problem lod3! We also made this blog post recently that might be a good source of info in the meantime as well. We'll definitely keep you updated.

    For your first question Dari, please have a look at my reply to OneShotGG, which details how to line up the iron sights of your weapon to the bullet firing/crosshair position. We will also add this info to our blog as a FAQ post.

    If you are trying to duplicate the MP5 weapon, it should work by selecting the MP5 weapon object under the FPS Weapons parent object in the Hierarchy window, duplicating it, renaming it to something like MP52, then adding a new spot on the Weapon Order list in the PlayerWeapons.cs script component of the FPS Weapons parent object, and then dragging your MP52 weapon object from the Hierarchy window to the new spot in the Weapon Order list in the Inspector window. If that still doesn't work, we can make a video showing these steps that might be easier to follow.

    The Reload and Ready animations were made in Maya. We would suggest doing the animation in Maya because that way you can select and make keyframes for the individual bones of the fingers and make any changes to the mesh if needed. You might be able to animate the position of the hand in Unity, and using Mechanim, it might be possible to animate the bones of the hand, but we haven't tried this ourselves yet. Please let us know if you have any more questions.
     
  30. Dari

    Dari

    Joined:
    Mar 25, 2013
    Posts:
    130
    MP5 animations still doesn't work, I created new spot in weapon order for my weapon and put it there and it's the same thing, maybe video would be useful :)
    I've also tried to make right position while aiming but it doesn't aim right, I can't explain, I'll take screenshots:

    This doesn't look like your MP5 while aiming. (I've downloaded the weapon model)
    $FPS01.JPG

    Your MP5:
    $FPS2202.JPG

    My weapon isn't perfectly shaped while aiming, I don't know if you got it?
    Now the aiming "circle" on my weapon shows the right direction of bullets but it's not well shaped.
    It's not in the same direction as other aiming thing.
     
    Last edited: May 3, 2013
  31. Deleted User

    Deleted User

    Guest

    Thanks for the screenshots! For aligning the gun sights, you might need to do some small adjustments of the yaw and pitch angles of the "MyWeapon_Anim" mesh object in the inspector, and then tweak the Zoom Xpos and Zoom Ypos values of WeaponBehavior.cs. It's sometimes easier to type in small decimal values to get the alignment right because using the rotation handles can be a bit coarse and cause the mesh to rotate too much. It might also help to make the change to FPSPlayer.cs I mentioned above that keeps the crosshair visible so you can line up the gun sights using the crosshair as a reference.

    As far as the MP5 animations not working, we've found out that simply duplicating an .fbx won't also copy Unity's mesh import settings, so you have to set them up again manually. Sorry if this has led to any confusion, but we have made a video on how to set up a new weapon that might help:

    [video=youtube_share;oh3GzWoceY4]http://youtu.be/oh3GzWoceY4

    Hopefully that makes the process more clear. Best of luck!
     
  32. Dari

    Dari

    Joined:
    Mar 25, 2013
    Posts:
    130
    Thanks! But I'm not sure you got me right :S
    I meant the animations on MP5 aren't working (MP5 weapon, FPS Weapon > MP5 > MP5_Anim = has animations in Animation folder but animations won't play in game mode)
    By the way, thanks a lot for this video, the MP5 animations are now working fine on my new weapon and I perfectly fit the iron sights so now it's looking excellent! Do you know how to import animations from Maya to Unity?

    Iron sights now:
    $MyWeapon01.JPG
     
    Last edited: May 7, 2013
  33. IndyLion

    IndyLion

    Joined:
    Jan 12, 2013
    Posts:
    14
    I will definitely be buying this product. Please don't make this a Unity 4 or above asset!
     
  34. Dari

    Dari

    Joined:
    Mar 25, 2013
    Posts:
    130
    It also says something in Console next to Project view:

    [mecanim]: BindSkeleton: cannot find Transform 'pCylinder13'
     
  35. OneShotGG

    OneShotGG

    Joined:
    Nov 16, 2012
    Posts:
    225
    Make sure your rig for your weapon is set to Legacy otherwise no animations will work. Unity auto makes everything a mecanim generic rig when you import it. You should not be using mechanim at all.
     
  36. OneShotGG

    OneShotGG

    Joined:
    Nov 16, 2012
    Posts:
    225
    Ok, so something I cannot figure out. How on earth do I get rid of the weird "Fish eye" effect? Yall have the FOV set to 75, there is no real reason why their should be a fish eye effect at such a low FOV (at 90 plus you expect it).

    I tried lowering it to 60 and then 50 but it is still present. Its really distracting when I look up and the trees in your sandbox test area appear to shrink unnaturally.

    I will make a video if I need to (if I am not making sense).
     
  37. Deleted User

    Deleted User

    Guest

    Good job on the iron sights, they look great. For the MP5 problem, as OneShotGG said, you want to check that the MP5_Anim Import Settings->Rig->Animation Type is set to legacy. The Import Animation box should also be checked under MP5_Anim Import Settings->Animations and the Fire, Reload, and Ready animations should be listed in the clips box with their correct animation frame ranges.

    To import animations from Maya into Unity, you just need to rig and animate your model in Maya, and copy the .fbx into your project's assets folder. The Animation Import Settings of the .fbx can be changed within Unity to suit your needs as well. Hope that helps.


    Thank you IndyLion! We actually use 3.5 for development and then test and add compatibility checks for 4.0 and up as needed (currently there is just one check in PlayerWeapons.cs). We think this is the best way to make our asset compatible with the widest range of setups.


    OneShotGG, do you notice the fish eye effect only in the trees or is it also in the level geometry? The main camera FOV is increased when sprinting to create a sense of acceleration on the camera that has somewhat of a fish eye effect.

    If you notice this mainly in the trees, it probably has to do with distant 2D tree billboarding. We notice this too. By default, the trees that you place on a Unity terrain object will get swapped out with 2D sprites when they are a certain range away from the camera for better performance. The issue is that the far away trees are only 2d images and they rotate to always face the camera. Ideally, they would only rotate on the Y axis, but they also try to stay parallel to the camera's horizontal pitch / x axis as well, which makes the far away trees move unnaturally and produce the fish eye effect.

    One of the solutions we've looked into for this is modifying the built in shader for the billboard trees so they only rotate to face the camera on the y axis and stay stationary on the other axes. The built in BillboardTree.shader can be be downloaded here, but I don't know yet if it's possible to affect the billboard angles of the distant tree creator trees by modifying the BillboardTree.shader.

    A possible workaround for this in the meantime would be to select the terrain object and then increase the Tree Billboard Distance and Tree Crossfade Length values of the Terrain script component to push out the distance that 3d trees are rendered and minimize the fish eye effect of the 2D trees. You can also try placing your own trees and then handle the billboard switching from your own script. We are looking into a way to change the billboarding of the tree creator trees and we will keep you updated.
     
  38. lod3

    lod3

    Joined:
    Mar 21, 2012
    Posts:
    671
    @Azuline

    How goes progress on the next release? Looking forward to see what's new, and to try out that new movement (jumping) code :)
     
  39. Dari

    Dari

    Joined:
    Mar 25, 2013
    Posts:
    130
    IT ALL WORKS NOW! That wasn't the problem, I mean I don't know what was the problem. I re-imported the asset and it all works fine now! I have all my weapons, animations again, MP5 is working, everything is working!
    Just one question, once I tried to do some changes so I can choose my weapon with number but then it said some errors and I couldn't fix them (re-imported the asset). Can you please tell me what I have to do?

    Thanks for your help, OneShotGG and Azuline!
     
    Last edited: May 9, 2013
  40. OneShotGG

    OneShotGG

    Joined:
    Nov 16, 2012
    Posts:
    225

    Its just the trees and it happens in the editor too. You are right about billboarding (don't know why I didn't think about that) as I went into one of the example scenes for Big Environment pack vol 2 and used the fps prefab and the issue was gone. So it has to do with the shader/billboards/settings you use for the trees in your example scene.

    Not a huge issue for me because I can use trees from BEPV2 and tweak things but I'd still look into it for those that want to use the trees yall provide.
     
  41. OneShotGG

    OneShotGG

    Joined:
    Nov 16, 2012
    Posts:
    225
    Did you attempt to add another keypress in the PlayerWeapons script? If so when you built the code did it come up with errors? You might have forgotten a semi-colon ( ; ) or something is wrong with your c# coding.
     
  42. Deleted User

    Deleted User

    Guest

    We looked into this some more and it seems that we fixed the tree issue by just changing a few of the Tree Detail Object settings for the terrain. Increasing the Max Mesh Trees amount and the Fade Length to the max of 200 seemed to minimize the issue. Though this means that more mesh trees are being rendered when 2D sprites wouldn't bee too noticeable if they didn't tilt with the camera, which is why we had the closer billboard start range for the trees by default.

    It still would be nice if there was an option to make the tree billboards have stationary pitch angles. There have been other requests for this as well. The trees will look better in the next version of the Realistic FPS Prefab and you can see them now on the dev build demo. Thanks for pointing this out OneShotGG!


    No problem Dari, glad you got it working! For the weapon selection by number key press, by default, it's only possible to select weapons up to number 6 because the code for selecting weapons 7-0 is commented out in PlayerWeapons.cs because pressing those buttons without a corresponding weapon object in the Weapon Order array causes an error (our demo scene currently only has six weapons). If you added a seventh weapon, you can change this code found in PlayerWeapons.cs around line 142:

    Code (csharp):
    1.             }else if (Input.GetKeyDown(FPSPlayerComponent.selectWeapon6)) {
    2.                 if(childNum != 6){StartCoroutine(SelectWeapon(6));}
    3.             }//else if (Input.GetKeyDown(FPSPlayerComponent.selectWeapon7)) {
    4. //                if(childNum != 7){StartCoroutine(SelectWeapon(7));}
    5. //            }
    to this:

    Code (csharp):
    1.             }else if (Input.GetKeyDown(FPSPlayerComponent.selectWeapon6)) {
    2.                 if(childNum != 6){StartCoroutine(SelectWeapon(6));}
    3.             }else if (Input.GetKeyDown(FPSPlayerComponent.selectWeapon7)) {
    4.                 if(childNum != 7){StartCoroutine(SelectWeapon(7));}
    5.             }
    ...to allow the seventh weapon to be selected by pressing the 7 key on the keyboard.


    Thanks lod3, progress is going well! We've been focused on some bug fixes and work has now started on implementing new features for version 1.17. The new movement code has really improved the jumping mechanics a lot :) We'll definitely keep you posted on our progress on version 1.17.


    One of the bugs we recently solved is where sometimes the weapon and camera would be misaligned if the player switched a weapon during a spike in CPU use or low framerate situations. To fix that bug you can add the bool animState around line 22 of CameraKick.cs:

    Code (csharp):
    1.  
    2.     private bool animState = false;
    and add these lines near the top of the Update() code in CameraKick.cs:

    Code (csharp):
    1.     void Update (){
    2.         //define external script references
    3.         FPSRigidBodyWalker FPSWalkerComponent = playerObj.GetComponent<FPSRigidBodyWalker>();
    4.         Ironsights IronsightsComponent = playerObj.GetComponent<Ironsights>();
    5.         FPSPlayer FPSPlayerComponent = playerObj.GetComponent<FPSPlayer>();
    6.        
    7.         //make sure that animated camera angles zero-out when not playing an animation
    8.         //this is necessary because sometimes the angle amounts did not return to zero
    9.         //which resulted in the gun and camera angles becoming misaligned
    10.         if(!animation.isPlaying){
    11.             if(!animState){
    12.                 CameraPitchAmt = 0.0f;
    13.                 CameraYawAmt = 0.0f;
    14.                 CameraRollAmt = 0.0f;
    15.                 animState = true;
    16.             }
    17.         }else{
    18.             if(animState){
    19.                 animState = false;
    20.             }    
    21.         }
    ...to make sure the camera angle animation values return to zero so the weapon and camera stay in alignment.
     
  43. Dari

    Dari

    Joined:
    Mar 25, 2013
    Posts:
    130
    Okay, it works now! Thanks! Do you know any website or anything where I can found sounds for weapons? (fire sound for example) I've also fixed the CameraKick.cs script bug, thanks for that :)
     
    Last edited: May 10, 2013
  44. Venged

    Venged

    Joined:
    Oct 24, 2010
    Posts:
    500
    I bought this asset yesterday. When I loaded the demo scene the terrain was missing and some of the textures seemed to be missing?

    Any suggestion for what I could I have done wrong?

    Thanks
     
  45. Dari

    Dari

    Joined:
    Mar 25, 2013
    Posts:
    130
    Venged,
    You can try to re-import the asset, also what version of Unity do you have?
     
  46. Venged

    Venged

    Joined:
    Oct 24, 2010
    Posts:
    500
    Thanks for the quick reply. I have version 4.1.2. I tried re-importing and still got errors when loaded that said some of the assets could not be found. When the demo runs everything is falling in space because of the missing items. Should I roll back to the previous Unity version?
     
  47. Dari

    Dari

    Joined:
    Mar 25, 2013
    Posts:
    130
    I'm not sure to downgrade your Unity, maybe it would be better to wait for Azuline Studios (creator of this asset) to answer the question.
    (that was fast reply by the way) :)
     
  48. Deleted User

    Deleted User

    Guest

    Thanks for the help Dari. Venged, sorry to hear the terrain isn't importing correctly. You shouldn't have to roll back to a previous version of Unity because the Realistic FPS Prefab has been tested to work with version 4.1.2f1.

    We'd like to ask a few questions to help us better understand the problem. You mention that the terrain is missing in the demo scene when you open it. First of all, are you able to create and test other scenes with terrain objects in them, or is it just our demo scene that has the problem? Also, when you open our demo scene, in the Hierarchy window, is there an object called "Terrain" listed there? if so, when you click on it, is the check box next to the terrain object's name checked in the inspector window to enable the terrain? The terrain's layer should also be set to layer 10 (World Collision) so objects won't fall through it.

    If you don't have a terrain object in the hierarchy window at all, there might have been a problem when importing or downloading the package. If you attempted to re import the package into a new empty project without success, you can try deleting the downloaded package found in C:\Documents and Settings\YourName\Application Data\Unity\Asset Store\Azuline Studios (XP) or C:\Users\YourName\AppData\Roaming\Unity\Asset Store\Azuline Studios (win7) and then re-download it from the asset store and try importing again.

    When you right click on the Project Library window and go to Import Package->Custom Package and the Import Package window pops up after selecting the Realistic FPS Prefab package, please make sure that the "All" button at the bottom left of the window is clicked and all the assets in the Import Package window have a check box next to them. Sorry if you already were doing that or it seems obvious, but I'm trying to predict where anything could go wrong with the import process.

    If the demo scene is still not working, could you please paste some of the errors you're getting here so we can get a better idea of the issue? Thanks for your patience Venged.


    Nice job! A website that we use a lot for sound effects is freesound.org. You can also use Audacity (great program) to mix your sound effects and export them to various formats.
     
    Last edited by a moderator: May 11, 2013
  49. Venged

    Venged

    Joined:
    Oct 24, 2010
    Posts:
    500
    Thanks for all the advice and the quick replies. It must have been corrupted during the download or import. I deleted the file as you explained above and redownlaoded and imported it. This time I did not use Unity at all while the download was in progress. Everything is working fine now. Thanks for creating such a nice asset. Now I don't have to fully reinvent the wheel when I get ready to add FPS to the TPS game I am working on.

    Wonderful asset. I can't say enough about it. As mentioned before you really gave a lot for the low price.

    Thanks

    Venged
     
  50. Dari

    Dari

    Joined:
    Mar 25, 2013
    Posts:
    130
    Azuline, what's the script for when I come close to some object (I can set how close), it shows the GUI Text on the screen and then after amount of the time it smoothly dissapear. Thanks :)