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

Dastardly Banana -(Free) FPS Weapons Package UPDATE- 0.95

Discussion in 'Assets and Asset Store' started by Jason_DB, Mar 29, 2010.

  1. Jason_DB

    Jason_DB

    Joined:
    Nov 30, 2008
    Posts:
    495
    Last edited: Dec 30, 2011
  2. Aiursrage2k

    Aiursrage2k

    Joined:
    Nov 1, 2009
    Posts:
    4,835
    Demo seems pretty solid
    If you want to test out the demos make sure to define the following inputs:
    Crouch, Reload, Pickup
     
  3. Maurice-Hoffman

    Maurice-Hoffman

    Joined:
    Jan 22, 2009
    Posts:
    182
    Thanx i like it very much, will you make a 3rd person version too ?
     
  4. Armagon

    Armagon

    Joined:
    May 29, 2009
    Posts:
    246
    Small bug: when you focus your crosshair at one of the weapons, in order to equip them, it doesn't matter if you're right next to it, or a few miles away. It's always able to equip them.
     
  5. Jason_DB

    Jason_DB

    Joined:
    Nov 30, 2008
    Posts:
    495
    There's actually a constant to control the distance, although it causes some bugs if you lower it in the current version. We've fixed it, though, so it won't be an issue in the next update.
     
  6. Armagon

    Armagon

    Joined:
    May 29, 2009
    Posts:
    246
    Sounds great. I'm at home now and dedicated some time to stress-test the demo. I few things i have noticed:

    • Crouching is a little abrupt... maybe some smoothing?
    • Same for aiming down the sights. Unity supports some sort of smooth camera movement/change?
    • When i crouch, keep holding C, and then jump, whether or not i'm holding C, i'm at normal state (not crouched).
    • Rockets sometimes go through walls or don't explode
    • Weapon models go through walls and objects
    • No matter how far, you actually hit something close to where you are aiming (aim at the mountains at the horizon, for example)
    • Muzzle-flashes appear at scopes
    Oh, and some suggestions:
    • Bullet holes
    • Player movement affects accuracy, depends on the movement (jumping, walking)
    • Crouching improves accuracy
    Amazing project, guys. Keep up the good work, the community thanks you!
     
  7. Aiursrage2k

    Aiursrage2k

    Joined:
    Nov 1, 2009
    Posts:
    4,835
    When going into crouch mode you might also want to resize the size of capsule (as it does not appear like its doing this).
     
  8. Jason_DB

    Jason_DB

    Joined:
    Nov 30, 2008
    Posts:
    495
    Thanks for taking the time to make all of these suggestions, since we're looking for things to fix/improve.

    • Crouching is a little abrupt... maybe some smoothing? - good idea. The crouching was sort of an afterthought so I didn't try to smooth it.
    • Same for aiming down the sights. Unity supports some sort of smooth camera movement/change? - right now we're just adjusting the field of view, but we could probably spread it out over multiple frames.
    • When i crouch, keep holding C, and then jump, whether or not i'm holding C, i'm at normal state (not crouched). - when you jump you leave crouch state, although I have switched the crouch to a toggle so you won't be holding the crouch button without crouching when you land.
    • Rockets sometimes go through walls or don't explode - this is called "collision tunneling", and would be fixed in the projectile script (the point of our launcher is that you can make the projectile be anything). The included projectile script is just a pretty basic example
    • Weapon models go through walls and objects - I'm not entirely sure how to address this, unless there is a way to make the weapons render on another layer on top of everything else or something.
    • No matter how far, you actually hit something close to where you are aiming (aim at the mountains at the horizon, for example) - you can adjust the accuracy of the weapon, and you can tell how accurate it is by the size of the crosshair (the bullets will hit somewhere within it)
    • Muzzle-flashes appear at scopes - Whoops, I'll have to fix that.

    also, @ aiursrage2k I just fixed that, so the collider actually gets smaller when you crouch.
     
  9. TwiiK

    TwiiK

    Joined:
    Oct 23, 2007
    Posts:
    1,729
    You can fix the weapons going through objects by rendering everything except the guns in one camera and the guns in another camera with a higher depth.

    You can read about it here: http://unity3d.com/support/documentation/Components/class-Camera.html
    It's also been discussed in a couple of threads on the forum.
     
  10. Wolf Dreamer

    Wolf Dreamer

    Joined:
    Sep 2, 2009
    Posts:
    142
    In the demo you can only hold two weapons at a time.

    I found the phantom gun or whatever its called in one of the dumpsters. Odd place to hide a weapon at.

    The official FPS tutorial already has working code for picking up a weapon by walking over it, and it assigned to the number keys 1 and 2. It has a machine gun, and a rocket launcher. And it can zoom in as well. You can jump around and shoot stuff and knock it back when you hit it also.

    That's something pretty cool.
     
  11. Jason_DB

    Jason_DB

    Joined:
    Nov 30, 2008
    Posts:
    495
    Thank you, that works perfectly (although I;m going to have to update some of the scripts to deal with the second camera).

    Also @Wolf Dreamer you can make the player hold up to 10 weapons if you really want to, I just set it to 2 in the demo scene. And I was wondering if anyone was going to find the dumpster gun.
    Yeah, the point of our stuff is to expand the basic things that the official tutorial did into something more comprehensive which has the features that you see in most modern FPS's.
     
  12. Wolf Dreamer

    Wolf Dreamer

    Joined:
    Sep 2, 2009
    Posts:
    142
    Cheetah 3D '.jas' are not supported by Windows. :{

    I fixed this error easily enough.

    Anyone can a converter program to turn .jas files into something Windows can use?
     
  13. Jason_DB

    Jason_DB

    Joined:
    Nov 30, 2008
    Posts:
    495
    Did any models appear to be missing? We encountered that error but all of the files appeared to be fine even though several of the models are jas files (including the rocket launcher).
     
  14. coin-god

    coin-god

    Joined:
    Jan 21, 2010
    Posts:
    325
    Pretty good work here. It will be very usefull for my game.

    Downlaoding now. About smoothing the aim down sights, theres a script caleld Aim Down Sights that does it very smoothly. You could check the code.
     
  15. Essal

    Essal

    Joined:
    Feb 16, 2010
    Posts:
    107
    I can't even begin to express my happiness:D

    This is great, I will definetly donate one of the following days when I get some cash into my account..XD
     
  16. Jason_DB

    Jason_DB

    Joined:
    Nov 30, 2008
    Posts:
    495
    Aiming, crouching, and crosshair movement have been smoothed and the update should be up within a couple of days.
     
  17. coin-god

    coin-god

    Joined:
    Jan 21, 2010
    Posts:
    325
    Great, btw in my game I use a second camera to render the guns, the problem is that somehow it makes the weapons move away from the character's sight when moving the camera view. Only seems to happen if i render them in a second camera.
     
  18. Jason_DB

    Jason_DB

    Joined:
    Nov 30, 2008
    Posts:
    495
    What's probably happening is that the camera rendering your weapons isn't staying aligned with your other camera, so the weapons appear to move away. While it's happening check if your two cameras have the same position and rotation. (Also make sure that either one camera is a child of the other or both have the mouseLook script).
     
  19. kindandrew

    kindandrew

    Joined:
    Mar 31, 2010
    Posts:
    18
    looks good better then the fps tutorial because of all the reloading aimations ect but i prefer pickup weapons like in the tutorial though good job cant wait until next update :idea: maybe some more weapons like throwing grenades
     
  20. coin-god

    coin-god

    Joined:
    Jan 21, 2010
    Posts:
    325
    Trowing nades is pretty easy actually, it took me a few hours to do, editing the Tutorial Rocket Launcher script. And i dont have a lot of Unity Scripting knowledge.

    Jason, you were right, I accidentally moved it while adding weapons.

    :!: Edit: just found out that if I use a real weapon sound the sound will stop before ending, unless I keep the fire button pressed. Which is not good for Pistols and Sniper Rifles.
     
  21. pickledzebra

    pickledzebra

    Joined:
    Feb 25, 2010
    Posts:
    33
    Hiya,

    Straight from the download package scenes I note that the player doesn't respond to typical movement keys (WASD, space, etc). Everything else weapon-related appears to work.

    ???

    I'm assuming it's some kind of configuration settings issue, but I don't see the solution immediately.

    Looking forward to digging into it more, but just curious is there's a quick fix for this.
     
  22. kindandrew

    kindandrew

    Joined:
    Mar 31, 2010
    Posts:
    18
  23. Jason_DB

    Jason_DB

    Joined:
    Nov 30, 2008
    Posts:
    495
    EDIT: I think the problem is that you didn't set up all of the necessary inputs, which glitched the movement. Look at the initial setup instructions here:
    http://www.dastardlybanana.com/SetupPopup.html

    Also @ kindandrew @ coin-god you can fire pretty much anything out of the launchers, so if you have a grenade projectile script it should work fine.
     
  24. atomic1fire

    atomic1fire

    Joined:
    Jan 16, 2009
    Posts:
    3
    I liked the demo for the script,
    at first I didn't think much out of it, but the demo holds a little more then you would expect it to.
     
  25. Jason_DB

    Jason_DB

    Joined:
    Nov 30, 2008
    Posts:
    495
    Version 0.91 has been released! check the first post or the site for details and the download link! It smooths out a lot of the rough edges (such as the zoom and crouch transitions) as well as fixing a couple of bugs. Additionally, a tutorial for adding secondary weapons is now viewable in the tutorials section of the FPSWeapons page.
    http://www.dastardlybanana.com/FPSConstructorWeapons.htm
     
  26. kindandrew

    kindandrew

    Joined:
    Mar 31, 2010
    Posts:
    18
    it works ok but iam getting the error IndexOutOfRangeException: Array index is out of range.
     
  27. Jason_DB

    Jason_DB

    Joined:
    Nov 30, 2008
    Posts:
    495
    It's a problem with the PlayerWeapons script which has just been fixed if you re-download.
     
  28. coin-god

    coin-god

    Joined:
    Jan 21, 2010
    Posts:
    325
    Thanks for the update. I see sounds work ok now.

    This is a suggestion for a next version:
    -Perhaps we could have an option to change the Mouse Sesitivity while aiming with scopes. When you set a big zoom factor it gets difficult to move the view smoothly. (Recommended)

    -Beeing able to adjust the actual zoom ingame, having a Min Zoom and a Max Zoom. Or maye 3 types fo zoom. (Just if you feel like doing it, not very important)

    And the only bug I seem to have is that when crounching my player actually looks like prone position. How can I adjust the weapon/camera position? The "Crounch Delta Height" only seems to affect the Box Collider, not the camera and weapons.
    My player is 2 units high, instead of 4. How to fix it without making him taller?
     
  29. Jason_DB

    Jason_DB

    Joined:
    Nov 30, 2008
    Posts:
    495
    Well you can't really change Crounch Delta Height while the game is running (it does some calculations in Start for the camera heights) which is why it isn't changing right.
     
  30. Armagon

    Armagon

    Joined:
    May 29, 2009
    Posts:
    246
    Hello Jason,

    Again, thanks for your hard work on this. The results are amazing and an excellent addition to the community.

    Quick stuff: Is the bobbing controlled by code or is it built into the weapon animation? If it's not controlled by code, have you considered implementing something similar to Quake 1 cl_bob? Not only bobs the weapon model, but the camera as well, giving a very interesting feel. You might want to check the bobbing controls from Quake 3 sources.
     
  31. kindandrew

    kindandrew

    Joined:
    Mar 31, 2010
    Posts:
    18
    i like how its coming a long hope more updates are on the way and i two would also love some quake in it:idea: some ideas ladder climbing ect but by the looks of it u proply want to keep it simple as possible
     
  32. coin-god

    coin-god

    Joined:
    Jan 21, 2010
    Posts:
    325
    Its actually controled by code, and yes what you say would look amazing. :)
     
  33. Armagon

    Armagon

    Joined:
    May 29, 2009
    Posts:
    246
  34. Jason_DB

    Jason_DB

    Joined:
    Nov 30, 2008
    Posts:
    495
    I'm going to look into the camera sway, although I might not be able to get it done before I go on vacation Friday. Also I'm planning on making a couple cool sample projectiles; a black hole which sucks objects in and then explodes and a "beam riding" rocket which you can guide with a laser after firing.
     
  35. Armagon

    Armagon

    Joined:
    May 29, 2009
    Posts:
    246
    What about implementing common elements, then? Railgun, melee attacks, shock rifles, bullet penetration... lot's of stuff around to play with.
     
  36. Jason_DB

    Jason_DB

    Joined:
    Nov 30, 2008
    Posts:
    495
    I've been planning on adding a lot of things (although you could probably make a railgun with what's already there) such as area-of-effect (like a flamethrower) and charged weapons. Bullet penetration could also probably be done with pretty what's already there by creating a tag or layer for objects that bullets can penetrate and having the bullet raycast ignore or continue past them.
     
  37. coin-god

    coin-god

    Joined:
    Jan 21, 2010
    Posts:
    325
  38. coin-god

    coin-god

    Joined:
    Jan 21, 2010
    Posts:
    325
    Im modifieng your script to suit my needs, and in gunscript.js i try to add a new varaible. But its not shown in the inspector, and I cant assign the gameobject I need to instantiate.

    I succesfully edited the ammodisplay script, in wich I added a variable for a gui text I use in my hud. But guncript seems to be.. diferent?
     
  39. JiffOrange

    JiffOrange

    Joined:
    Mar 26, 2010
    Posts:
    22
    Hi all,

    Great set of scripts, much thanks for all the effort :)

    I have been trying to mod the ammodisplay.js script to include a small GUI image for the weapon 'currently' in use. If I add a texture to it, and add the code to the script it works great except that it displays all the images at the same time :cry: I also tried editing the weaponsInfo and weapon selection scripts and again had success but to varying degrees but regardless of where the changes are made I m unable to pass any type of check for weather or not the current weapon is selected (also edited gunscript as this seemed to be the most logical place but as stated before nothing show in the inspector for the texture).

    Anybody got any ideas on how to go about this? I will happily supply the code once working for integration into the project if you would like or as an add on.

    Suggestions for improvements, would be dual wield, had a go at this its almost possible by attaching two gunscripts, setting both to primary weapon but the fire animation messes things up.

    Cheers,
    Jiff
     
  40. davew175

    davew175

    Joined:
    Aug 10, 2008
    Posts:
    56
    The weapons package has custom editors defined in the editors folder. If you add variables you'll also need to add them to the associated editor script.

    Also, there's a Boolean that controls whether a gun is active. I'm not at a computer now but will respond later today with details.
     
  41. Armagon

    Armagon

    Joined:
    May 29, 2009
    Posts:
    246
    I could not find any other bugs. Clean and stable! Now let's just wait for the new features. :D

    Seriously, guys, amazing contribution!
     
  42. JiffOrange

    JiffOrange

    Joined:
    Mar 26, 2010
    Posts:
    22
    Thanks for that ....was not aware, will have a look today and report back, any other info you might be able to provide is greatly appreciated. I will of course post anything I do manage o get working so you guys can implement it, if you should so wish! Just got to say it again 10 out of 10 ...not finding any bugs in this release :)

    Cheers,
    Jiff
     
  43. lesPaul456

    lesPaul456

    Joined:
    Apr 16, 2010
    Posts:
    2
    I just downloaded the package and made a test scene, but I'm having some problems. The guns are going inside of the walls and the muzzle flash is showing up overtop of the gun.

    Did I miss a step? All I did was drag the Player prefab into the scene, and add one of the guns that came with the package into the default weapon's AimObject. Any time I hit into a wall, though, the gun passes right through.

    Any ideas? Thanks!
     
  44. lesPaul456

    lesPaul456

    Joined:
    Apr 16, 2010
    Posts:
    2
    I figured it out. I didn't add the gun to the WeaponCamera's layer. :oops:

    Nice job by the way!
     
  45. Aiursrage2k

    Aiursrage2k

    Joined:
    Nov 1, 2009
    Posts:
    4,835
  46. Jason_DB

    Jason_DB

    Joined:
    Nov 30, 2008
    Posts:
    495
    I just wanted to post that I've just gotten back from Europe and will start working on a new update immediately to try putting in some of the suggestions (as well as some custom editor cleanup to make it easier to modify the scripts).
     
  47. Mimetic

    Mimetic

    Joined:
    Apr 27, 2010
    Posts:
    35
    First of all, thank you so much for providing this package, you cannot imagine how helpful it is.

    I did have a quick question though, is there a way to disable weapon sway when aiming down the sights?
     
  48. alimolavi

    alimolavi

    Joined:
    Apr 19, 2010
    Posts:
    35
    Hi men, good work i use it for my game...
    i read FPSWalkerDB and i dont understand some line of this script :


    Code (csharp):
    1.  1- if(mainCamera.transform.localPosition.y + (crouchDeltaHeight*Time.deltaTime*8) > standardCamHeight)
    2. 2-  var flags = controller.Move(moveDirection * Time.deltaTime);    grounded = (flags  CollisionFlags.CollidedBelow) != 0;
    can u help me !?
     
  49. Jason_DB

    Jason_DB

    Joined:
    Nov 30, 2008
    Posts:
    495
    Well #1 is when the player is standing back up from crouching. While you stand back up it moves the camera upwards every frame until it hits its target (standardCamHeight). That line is saying that if we are going to add too much this frame (and pass our target) we'll just move to the target position instead.
    Code (csharp):
    1.  
    2. //are we going to pass our target this frame?
    3. if(mainCamera.transform.localPosition.y + (crouchDeltaHeight*Time.deltaTime*8) > standardCamHeight){
    4.         //if we are, just move to the target immediately
    5.     mainCamera.transform.localPosition.y = standardCamHeight;
    6. } else {
    7.         //if not, just move towards the target
    8.     mainCamera.transform.localPosition.y += crouchDeltaHeight*Time.deltaTime*8;
    9. }
    10.  
    11.  
    #2 is actually from the original FPSWalker script (so I didn't write it) but it appears to be here the script checks whether or not the player is touching the ground.
    I hope this helps!

    Also I'm working on a way to disable (or change the speed of) weapon sway while aiming, but its being pretty stubborn.
     
  50. wizardious

    wizardious

    Joined:
    Dec 31, 2009
    Posts:
    189
    Hi
    I can't seem to get the tutorial movies to play. Do you have any idea why this is? When I click on the link, it just seems to load forever. Is there another way I could get these vids? I really like what you have done, thank you for the great addition to Unity.
    [edit]
    I figured out that I could just right click the link and "save target as" to get the file. Now I can watch at leisure.
    Thanks!