Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice
  3. Dismiss Notice

FPS Constructor - Makes creating an FPS easy!

Discussion in 'Assets and Asset Store' started by Jason_DB, Dec 30, 2011.

  1. Jason_DB

    Jason_DB

    Joined:
    Nov 30, 2008
    Posts:
    495
    @winresh download the latest version of the FPS Constructor, it has a new scene called MobileJoystick that has joysticks set up.

    @cloudfun Just to clarify - you want the accelerometer to control both turning and movement? You can do that by deleting the joystick and adding the 'Tilt' component to the MouseX and MouseY inputs. Then drag the input item into the inputItem variable and tune the other variables to your liking.
     
  2. winresh

    winresh

    Joined:
    Mar 31, 2012
    Posts:
    13
    thanks,,where can i download it?
     
  3. Jason_DB

    Jason_DB

    Joined:
    Nov 30, 2008
    Posts:
    495
    @winresh you can update by redownloading from the asset store.
     
  4. winresh

    winresh

    Joined:
    Mar 31, 2012
    Posts:
    13
    ok thanks
     
  5. RandAlThor

    RandAlThor

    Joined:
    Dec 2, 2007
    Posts:
    1,294
    Is there some kind of melee attack inside this kit?
    Something like hitting the enemy with the riffle, a knife or with the fist?
    If not i would suggest this ;)
     
  6. Jason_DB

    Jason_DB

    Joined:
    Nov 30, 2008
    Posts:
    495
    @RandAlThor yes, there is a default melee weapon type for hitbox melee (including cycling hit animations). If you wanted to be fancy you could also use the charge weapon system to make a more complex melee system.
     
  7. cloudfun

    cloudfun

    Joined:
    Oct 2, 2011
    Posts:
    35
    hi jason, no that not what im looking for
    im looking for the same control that you put onthe mobilescene, whitout joysticks, but i would like to add one more thing
    when the user moves the phone o ipad right and left it just moves horizontaly, and is good but i would like to move the view, the crooshair, just like if he was moving the X yoistick, but without use the yoistick , cause the horizontal or tilt movement are good but i would like to add the turn movement without tocuh the screen
    sorry about my english is not my first language, and thanks a lot in advance
     
  8. Jason_DB

    Jason_DB

    Joined:
    Nov 30, 2008
    Posts:
    495
    @cloudfun Ok. The turn movement is controlled by a script named tilt.js. Just delete the joystick and add another copy of tilt somewhere in the scene. Set the axis of tilt to be x, and drag the 'MouseX' Input item into its IntputItem slot.
     
  9. RandAlThor

    RandAlThor

    Joined:
    Dec 2, 2007
    Posts:
    1,294
    I would like to know it the shop system will come into this asset as an upgrade not so far and if you will make a multi player feature to like co op via bluetooth on ios i.e. ?
     
  10. RandAlThor

    RandAlThor

    Joined:
    Dec 2, 2007
    Posts:
    1,294
    Ok, just bought it and played with it on the iPad (3rdgen) and have to say that it is realy nice besides some little things that i think can be configured.
    So you have a great FPS kit here :)

    Now i have to read true the doc and hope that i find my answers.

    If you or someone else can tell me how to use ngui with this kit it would be fine.

    I find it hard to aim with the joystick settings that come with it and thinking about to aim/look with accelerometer, is this possible with your kit?

    Is the orbital laser designator not possible in the mobile version?

    Edit:
    Is interacting with objects not possible on mobile because in the joystick scene i can not find the health and ammo boxes?
     
    Last edited: Jul 3, 2012
  11. Jason_DB

    Jason_DB

    Joined:
    Nov 30, 2008
    Posts:
    495
    @RandAlThor Thanks! I'm looking into te best way to support multiplayer with the package. I'm not sure when it would come, though.

    It's easy to use NGUI with the kit. Every part of the GUI is in scripts in the 'Editable' folder. These can be changed to modify the display, including using NGUI.

    You can look with the accelerometer if you want. The control is done with the InputItems in the scene (under Manager/InputDB). Each input has a value that can be changed by scripts. For look control you would want to change the axis values on MouseX and MouseY.

    The Orbital Laser doesn't work right on iOS because the technique for displaying the target isn't supported on mobile (it's a projector). It would still fire, though, and could be changed to work.

    Interacting is possible - you would just need to set up an input for the 'Interact' input. I didn't include it because it didn't seem important for the example control scheme.
     
  12. slimjim2417

    slimjim2417

    Joined:
    Feb 14, 2012
    Posts:
    45
    Hello it's me again, I am working on another weapon, a sniper but i want a custom scope texture. I already have a scope texture I got off google and edited in Photoshop so there was no background. I just don't know how to make it work
     
  13. Jason_DB

    Jason_DB

    Joined:
    Nov 30, 2008
    Posts:
    495
    @slimjim2417 There are variables for scope texture on the AimObject script (they only show up if the weapon is set to have a scope). Note that you'll want to export versions of the texture for different aspect ratios (that's why there are multiple variables for scope texture).
     
  14. slimjim2417

    slimjim2417

    Joined:
    Feb 14, 2012
    Posts:
    45
    ya i kinda figured that, i just need to find out how to do that.
     
  15. slimjim2417

    slimjim2417

    Joined:
    Feb 14, 2012
    Posts:
    45
    Hey i am having a tough time doing the aspect ratios I can't get it to work in any program i use, is there a specific program you use that i could, or is there any chance that I could email you the JPG or photoshop image so you could work with it? Or just tell me what program does this best? Please and thank you.
     
  16. Jason_DB

    Jason_DB

    Joined:
    Nov 30, 2008
    Posts:
    495
    @Slimjim Any program can do it, it's just a matter of having the image be the right size. You can use the dimensions of the included scope textures as a reference. If you're using Photoshop just make a new image and set its size based on pixels to be the right ratio.
     
  17. slimjim2417

    slimjim2417

    Joined:
    Feb 14, 2012
    Posts:
    45
    I just can't get it to work, ive tried resizing the image, cropping it, and exporting it to video using JPEGs in photoshop and nothing I try works. The image is at a default of 800x600 pixels, so i was wondering if the pixel number had to be the same as in the AimObject script, and i have tried that I just simply cant get it working, Im going to use the default scope just for animating and setting my weapon up and once I get the scope working I'll switch. I just can't figure this out.
     
  18. Jason_DB

    Jason_DB

    Joined:
    Nov 30, 2008
    Posts:
    495
    @slimjim2417 What isn't working, exactly? You can put any texture you want into AimObject and it will work (the aspect ratio stuff is just a guide to make a texture that will look good). There's no reason for you to be exporting to video or anything like that, just export a png from Photoshop.
     
  19. slimjim2417

    slimjim2417

    Joined:
    Feb 14, 2012
    Posts:
    45
    hahaha i got it working they have to be PNGs hahaha
     
  20. Jason_DB

    Jason_DB

    Joined:
    Nov 30, 2008
    Posts:
    495
    @slimjim I didn't realize it required it, although I have found png to be the best bet for transparent textures in Unity.
     
  21. slimjim2417

    slimjim2417

    Joined:
    Feb 14, 2012
    Posts:
    45
    I dont know i was using JPGs and it wwasnt working so i guess it was just me
     
  22. slimjim2417

    slimjim2417

    Joined:
    Feb 14, 2012
    Posts:
    45
    Hey its me again, just a quick question, I am setting up casing ejections on my weapon, I attached all the scripts to my casing model like it is on yours, but when i shoot the casing flys backwards and to the left of my character, I looked at the script and thought that it was a simple rotation of the player but when I rotated it 180 degrees it still did the same thing?
     
  23. Jason_DB

    Jason_DB

    Joined:
    Nov 30, 2008
    Posts:
    495
    @slimjim2417 It's actually determined in the shell script (something I should probably change). Try changing the second line of shell.js to this:

    that will switch it to fly in the opposite direction, so right instead of left.
     
  24. slimjim2417

    slimjim2417

    Joined:
    Feb 14, 2012
    Posts:
    45
  25. slimjim2417

    slimjim2417

    Joined:
    Feb 14, 2012
    Posts:
    45
    for the casing things, I tried that on the two scripts i found, the shell script, and the ejectedShell dcript, they both did not work, the ejected shell had no effect, but when i did it to the shell script it made it worse, the shell now will fly in random directions for ever, like a fly, and if the player gets hit by a shell it launched me across the map, i dont know what im doing wrong
     
  26. slimjim2417

    slimjim2417

    Joined:
    Feb 14, 2012
    Posts:
    45
    Also when i changed the line on the scripts i saved the file as a new script but it changed the line on the default script so i need the original second line on the EjectedShell.js and the second line in the update function in the Shell.js
     
  27. Jason_DB

    Jason_DB

    Joined:
    Nov 30, 2008
    Posts:
    495
    @slimjim the existing shell script is kind of a relic which forces you to guess and check within the code which direction you need to use force in based on your shell prefab. I'm writing a new one now that allows you to play with force values in the inspector to get it right.
     
  28. Jason_DB

    Jason_DB

    Joined:
    Nov 30, 2008
    Posts:
    495
    @slimjim Replace the ejectedshell.js script with the following. This will allow you to tweak the force values until it flies out properly.

    I'll be adding this into the next update as well. Also, the video is very cool! What kind of game are you making?
     
  29. NightHawk

    NightHawk

    Joined:
    May 30, 2012
    Posts:
    127
    Hi!

    I have brought your package and it's really good! :)

    I found a few problems/bugs though.
    1. When I test run my game the ammo display turns off by it's self.
    2. I tried making a scoped weapon and the scope texture does not show up.
    3. When the player gets pushed by... Let's say a cube enemy, the player will be pushed all the way up into the air.

    Is there a fix to these issues?
    Note: I made this custom weapon off of the FAL (New model, different stats). I have a feeling that's the reason some things are not working.

    Also 1 question. Which input is the switch secondary fire set to?

    Thanks, Nighthawk
     
    Last edited: Jul 14, 2012
  30. Jason_DB

    Jason_DB

    Joined:
    Nov 30, 2008
    Posts:
    495
    @NightHawk

    Hi!

    Thanks for purchasing!

    1. What do you mean? Does it disappear while the weapon is still active?

    2. DId you put scope textures for the different aspect ratios? It's best to have a texture for each of them.

    3. Does he go flying, or just jump up a bit?

    Also, making a custom weapon based off of an existing weapon is usually the best and fastest way to get a similar weapon started so that shouldn't cause any problems.

    Finally, I the secondary fire is set to ` by default (left of number keys on a mac keyboard), although you can change that in input settings.

    Thanks,

    Jason
     
  31. NightHawk

    NightHawk

    Joined:
    May 30, 2012
    Posts:
    127
    @Jason_DB

    1. It's working it's just that when I first launch my game for play testing it does not initially show up. But if I change to another weapon and change back I can see it again.
    2. I fixed that issue.
    3. The player flies all the way up into the air, It's not doing it anymore but this also happens when I prone and shoot at the ground with a FAL and rarely another weapon.

    I have some more questions.

    1. I could not find the input for secondary fire. Also it switched to secondary fire when I pressed w, shift, and right click.
    2. Is there a way to get the DrawRay dot to get bigger? it's a tiny dot on my screen.
    3. Is there a way to prevent the AI from flipping over? I am using boxes like the example bots. But I notice the example ones do not flip over. I there a way to prevent that?


    Thanks, Nighthawk
     
    Last edited: Jul 15, 2012
  32. smkt11

    smkt11

    Joined:
    Feb 16, 2012
    Posts:
    7
    Hi! I have been creating my own weapons and animations, but i keep getting the same problem with my reload animation, i dont know why but it just doesn't play... i have tried remaking the animation and changing the names in the gun child animation, but this keeps happening(only when is childed to the aim object)

    Thanks!
     
  33. NightHawk

    NightHawk

    Joined:
    May 30, 2012
    Posts:
    127
    I have been getting some errors when I fire some of my weapons.

    Code (csharp):
    1. IndexOutOfRangeException: Array index is out of range.
    2. EffectsManager.ApplyDecal (UnityScript.Lang.Array info) (at Assets/Plugins/FPS Constructor V1/ScriptsDB/CommonlyUsed/Managers/EffectsManager.js:185)
    3. UnityEngine.Component:SendMessage(String, Object, SendMessageOptions)
    4. GunScript:FireOneBullet() (at Assets/Plugins/FPS Constructor V1/ScriptsDB/WeaponScripts/GunScript.js:807)
    5. $:MoveNext() (at Assets/Plugins/FPS Constructor V1/ScriptsDB/WeaponScripts/GunScript.js:696)
    Is there something I am doing wrong?

    EDIT: I also get this debug log:
    Code (csharp):
    1.  
    2. nameThumper
    3. UnityEngine.Debug:Log(Object)
    4. GunScriptEditor:OnInspectorGUI() (at Assets/Plugins/Editor/GunScriptEditor.js:240)
    5. UnityEditor.DockArea:OnGUI()
    It shows up a lot in the console. Is there a cause to this?

    EDIT2: I have a annoying and game breaking bug. I used the Unity Animator to make temporary animations for one of my weapons. Once I applied the animations the weapon was still active. The weapon model is not active but when I shoot one of my other weapons the other weapon fires. I am going to see if I can fix the issue.

    EDIT3: I found some more info on the issue. The weapon seems to activate it's self when the game starts. I checked several times to see if I did something wrong, I found nothing. When I deactivate that weapon while playing, the weapon I start with is perfectly fine. Initially, when I pick up the bugged weapon everything is fine, and when I drop it everything is normal.

    EDIT4: Ok. I disabled that other bugged weapon. I changed the aimobject and the projectile speed on the FAL's secondary and now it's bugged like the other weapon. :|
     
    Last edited: Jul 16, 2012
  34. smkt11

    smkt11

    Joined:
    Feb 16, 2012
    Posts:
    7
    Sorry my problem was that i had to change the wrap mode to loop in the import settings, im very new, sorry...
     
  35. cloudfun

    cloudfun

    Joined:
    Oct 2, 2011
    Posts:
    35
    hu jason, everyone
    i will add a minimap to my game, any recomendation of some prefab or sample or whatever?
    thanks a lot in advance
     
  36. Jason_DB

    Jason_DB

    Joined:
    Nov 30, 2008
    Posts:
    495
    Sorry, didn't have the chance to catch up on this thread for a bit.

    @smkt glad it's working!

    @cloudfun I actually have a simple radar script on my site, although as far as an actual minimap I don't know.


    @nighthawk
    Do the errors happen in the demo scene (and if so have you edited the demo scene)?

    I'm not sure I completely understand the bug with the animator, but make sure that
    -The weapon is deactivated when you start the game (use the button on the gunscript).
    -The animation on effects objects under the AimObject.

    To the previous questions:
    1. But the weapon itself works fine?
    3. I've only run into that problem when the physics settings aren't properly set up. Double check that in the collision matrix "player" and "player" don;t collide, and "Player" and "IgnorePlayer" don't collide either.
    ----
    1. I believe that the input for secondary weapons is FIre2.
    2. It's actually a ray, which is the issue. I'll write a new version that's more visible and post it.
    3. I think that it's just from freezing the rigidbody on the enemy. Make sure that the x and z rotations are frozen.
     
  37. NightHawk

    NightHawk

    Joined:
    May 30, 2012
    Posts:
    127
    @Jason_DB
    ----------

    1. Yes. It works.
    3. I will try that.

    ----------
    1. Ok. I will see if it works.
    2. I found something that works a bit better then the drayray. I duplicated the launcher crosshair, made a new material, then (I am not sure if this texture is in the package) changed it to a circle texture named "Hard".
    3. Ok. I did that. I am going to test it.
    ----------
    Ok. For that bug I was getting. I am going to use Weapon1, Weapon2, and Weapon3 for a better example. When I launch the game, I start with weapon1 (Default weapon). Weapon2 activates, even though I made sure it was disabled. When I fire weapon1, weapon2 fires at the same time (Which is the FAL). The secondary and primary fires at the same time. Weapon 3 is also bugged. I disabled weapon3 for testing purposes. When I re-enabled weapon3, all 3 weapons fire at the same time. I have no idea what causes this. I made sure I was not doing something wrong.
    ----------
    Is it alright if I donate some models/improved weapon stats and donate some more things to the documentation?\

    EDIT: Also can the radar that is available on your web site be customizable?
    EDIT2: I made an ammo box and the limited function seems to not work :|

    Thanks, Nighthawk :)
     
    Last edited: Jul 16, 2012
  38. Jason_DB

    Jason_DB

    Joined:
    Nov 30, 2008
    Posts:
    495
    @NightHawk

    I think the easiest thing would be for me to take a look at your actual project, it's pretty much always the quickest way to work out these kinds of problems. If you PM me your email address I can share a dropbox folder for you to put it in.

    Also, donating anything you have the rights to would be much appreciated and of course credited in the package :).

    -Jason
     
  39. NightHawk

    NightHawk

    Joined:
    May 30, 2012
    Posts:
    127
    I can PM you a video instead. Is that alright?
     
  40. Jason_DB

    Jason_DB

    Joined:
    Nov 30, 2008
    Posts:
    495
    @NightHawk letting me access the project means that I can debug it myself instead of relaying instructions, making the process much faster and more effective. Once the problem is fixed I'll delete all of your files from my machine, but because of how dropbox works you'll have a copy of the corrected project.
     
  41. NightHawk

    NightHawk

    Joined:
    May 30, 2012
    Posts:
    127
    I have a question.

    How can I have the cross-hairs to be visible when aiming down the sights?
     
  42. Jason_DB

    Jason_DB

    Joined:
    Nov 30, 2008
    Posts:
    495
    @NightHawk there's a variable for it, although it's actually hidden. I'll unhide it in the next update, but for now paste this line:

    into SmartCrosshairEditor at line 57. Then you can turn on 'Debug Mode' on SmartCrosshair on the weapon camera.
     
  43. NightHawk

    NightHawk

    Joined:
    May 30, 2012
    Posts:
    127
    Alright. I am testing a couple more things and I will send you the file.

    For the RPM, I tried calculating the RPS by dividing the RPM by 60 and I got an RPS that seem to not match. Is there something to calculate what the RPM/RPS is exactly?

    Also I found some more info on the issue. It seems to pop up when I get the debug log:

    nameWeaponNameHere
    UnityEngine.Debug:Log(Object)
    GunScriptEditor:OnInspectorGUI() (at Assets/Plugins/Editor/GunScriptEditor.js:240)
    UnityEditor.DockArea:OnGUI()

    EDIT: When I press the activate/deactivate button I have to press it twice to activate the weapon but once to deactivate it. It seems to be only deactivating the model but not the actual gun.

    EDIT2: I have encountered another bug. When you hold down the fire button the accuracy keeps going up.
     
    Last edited: Jul 16, 2012
  44. Jason_DB

    Jason_DB

    Joined:
    Nov 30, 2008
    Posts:
    495
    After looking at the project I able to fix Nighthawk's errors. It came down to an issue in one of the weapon prefabs where the prefab was set to be 'active' (using the button on the gunscript), causing irregularities. I will put a fix in the next update to prevent this from causing errors, but in the meantime make sure not to set your prefabs to be active.

    A sort-of related note - In general it is also best to leave the included prefab weapons as they are, both to serve as a reference later and because they can be overwritten by future versions of the package.
     
  45. NightHawk

    NightHawk

    Joined:
    May 30, 2012
    Posts:
    127
    Thank you so much for your help!
    Your support is great :)

    Thanks, Nighthawk
     
    Last edited: Jul 18, 2012
  46. Jason_DB

    Jason_DB

    Joined:
    Nov 30, 2008
    Posts:
    495
    Hi,

     
  47. NightHawk

    NightHawk

    Joined:
    May 30, 2012
    Posts:
    127
    Thanks, Nighthawk.
     
  48. Jason_DB

    Jason_DB

    Joined:
    Nov 30, 2008
    Posts:
    495
    @Nighthawk Well, the rate of fire is the time, in seconds, between shots. That means that RPS is 1/rate and RPM is 60/rate. Therefore rate = 60/RPM or 1/RPS. 900RPM would be 60/900 or .067.

    To make the ammo crate animate you would need a modified version of the AmmoPickup.js script, adding the animation into the Interact() function. Basically, anything you put in the Interact() function on an object with a collider will be executed when the player 'interacts' with it. The ammo is just an example implementation of it.
     
  49. NightHawk

    NightHawk

    Joined:
    May 30, 2012
    Posts:
    127
    Thanks, Nighthawk
     
  50. Jason_DB

    Jason_DB

    Joined:
    Nov 30, 2008
    Posts:
    495
    @NightHawk

    Whoops, that's an oversight in the AmmoPickup script. Shared ammo weapons need to call their ApplyToSharedAmmo() function after changing ammo counts. Add this

    to line 25 of AmmoPickup.js (There should be two close braces after it).