Search Unity

  1. Calling all beginners! Join the FPS Beginners Mods Challenge until December 13.
    Dismiss Notice
  2. It's Cyber Week at the Asset Store!
    Dismiss Notice

Realistic FPS Prefab [RELEASED]

Discussion in 'Assets and Asset Store' started by Azuline-Studios, Apr 5, 2013.

  1. Azuline-Studios

    Azuline-Studios

    Joined:
    Apr 5, 2013
    Posts:
    203
    Nice job narrowing down the model rendering issue to static batching, rcgmhds. Most of the immobile objects in the demo scene have their static boxes checked so they will receive and cast lightmap shadows. Static batching is a pro feature, so that might’ve been causing the problem.

    The issue with using a negative value for the Player Height Mod var probably has to do with the speed that the height of the capsule is increased, resulting in too much of an overlap of the capsule with the ground collider. We will be fixing this in the next version.

    Good to hear you also found solutions for the NPC height and animation issues you mentioned. As far as adjusting the scale of the NPCs, another option might be to keep the object’s scale at, or close to 1,1,1 then changing the scale factor of the character mesh in the Mesh Import Settings and modifying the character controller capsule height and Y Center value of the NPC to fit the resized mesh.

    Improved NPC AI is on the way, which will probably use an open/free pathfinding system to start, so that all users will have access to it. Dynamic wandering should be fairly simple to implement, as it would involve selecting a random, nearby point, doing a capsule check to see if the NPC can fit there, and then moving the NPC to it. Thanks for the suggestion.


    Hi DevGuy, I wish we had a specific example on how to spawn enemies over an area using our asset, but you might want to have a look at this link and this link on Unity Answers which covers the subject. In the example code posted on those pages, there are some lines with instantiate calls that you could modify to instantiate NPC prefab objects.

    The Thirst and Health screen elements can be moved by selecting the HungerText or ThirstText objects in the project library located in: Assets\!Realistic FPS Prefab Files\!Objects\HUD. You can then change the Horizontal Offset and Vertical Offset values of the HungerText.cs and ThirstText.cs components to change their onscreen positions. The parent object’s offsets will move the main color and the child object’s offsets will move the shadow color. You can also change the font of these GUIText objects here as well.

    Also, the hitPoints, hungerPoints, and thirstPoints vars of FPSPlayer.cs can be used to reference the current amounts that are displayed onscreen for use with a GUITexture. Hope that helps.
     
  2. rcgmhds

    rcgmhds

    Joined:
    Feb 2, 2013
    Posts:
    21
    Changing the scale factor to 0.0125 is perfect aside from the fact that, at runtime, the mesh compacts itself onto the rigging; you end up getting a model that looks like it has a lot of extra skin wrapped around a small frame.
     
    Last edited: Dec 6, 2013
  3. Azuline-Studios

    Azuline-Studios

    Joined:
    Apr 5, 2013
    Posts:
    203
    Right, sorry about that, rcgmhds. That method would work for non-rigged models. I just tested changing the scale of a parent zombie NPC object and was able to proportionately scale up and down the NPC (the model and character controller capsule scaled proportionately) and everything seemed to work correctly with the NPC targeting and attacking the player, and moving around the scene.

    It’s nice that Unity has the ability to do this easily, as sometimes the ability to scale a rigged model requires some extra work by the animator/rigger. Mainly, there should be a parent transform above the skeleton/rig transforms that can be scaled globally and proportionately applies that scale to the child objects. So it should be possible to scale the model in a 3D application as well.

    You can also try scaling just the skeleton object in the inspector (the object without the Skinned Mesh Renderer component). For the default zombie model, this object is called “joint1” and is a child of the ZombieNPC object. This should proportionately scale the model because the mesh will inherit the new scale of the rigged skeleton.

    When you mentioned that the scaled NPCs weren’t registering hits on the player, were there any error messages? Version 1.18 also introduced a var to NPCAttack.cs called inaccuracy that allows the NPCs to miss their target occasionally, so that might be related. Thanks for your feedback.
     
  4. shkar-noori

    shkar-noori

    Joined:
    Jun 10, 2013
    Posts:
    833
    I'm really happy with this asset...I'm using it for 3 months now and i believe that this can be my in game FPS Kit , here is a video of my game and a little teaser for destruction:
    http://www.youtube.com/watch?v=f_iWetBSDXg

    I would like to see these new features:

    1 - Laser Effect for weapons.
    2 - Having human model instead of just arms and weapon.
     
  5. rcgmhds

    rcgmhds

    Joined:
    Feb 2, 2013
    Posts:
    21
    Yeah, I'm going to continue to work with scaling what I have that didn't come in the FPS prefab. I found something else that was quite interesting and you may know how to work around it.

    I created a script that opens and closes a door based on how close to the object the player is (sphere collider being the trigger). I even added highlighting (no shader involved) to the object when the player is inside of the sphere collider. However, when the door is fired at the hit marks are on the sphere collider when they should be on the mesh collider attached to the door. Do you know a work-around to ignore the colliders that are marked as triggers?

    As always thanks a lot, Azuline.
     
    Last edited: Dec 8, 2013
  6. sistematix

    sistematix

    Joined:
    Dec 26, 2012
    Posts:
    9
    got some trouble when i tried to build the standalone for win x86, it suddenly crash, microsoft visual run time library error...
     
  7. shkar-noori

    shkar-noori

    Joined:
    Jun 10, 2013
    Posts:
    833
    set layer of the sphere collider to Ignore Raycast
     
  8. GageLucasDev2

    GageLucasDev2

    Joined:
    Jul 24, 2013
    Posts:
    77
    Yea i didnt think to check to see them in the hierarchy. I usually test in maximize.

    Another question. Is there any simple way to reference the variables in a GUItex or does that require another script to handle adding and subtracting from the Texture?

    And this is off topic, but is there possibly a way to project a shadow of a 3d character model for the FPS character? Its not needed but it does add a sense of wholeness when playing a dark level and casting shadows.

    Thanks for the continued support.
     
  9. rcgmhds

    rcgmhds

    Joined:
    Feb 2, 2013
    Posts:
    21
    I'll look into it. Thanks for the suggestion.

    @Azuline. I'm using your ladder prefab in a very large scene (25 terrains at 1024 resolution, 5x5). Everything is great in the editor, but when I build it and run it I notice a very significant fps decrease; the game crawls at around 6 fps and without the prefab it runs at approximately 40 fps. Any suggestions?
     
  10. Azuline-Studios

    Azuline-Studios

    Joined:
    Apr 5, 2013
    Posts:
    203
    Thanks Shkarface Noori Great work on the destructible objects and new weapons! For your question about a laser effect, do you mean like a laser sight for aiming? A basic effect like this could be done by creating a thin cylinder in a 3D program, texturing it so it is slightly transparent and fades out further from the muzzle, then attaching this laser mesh to a weapon model or a laser sight module/component. A laser dot could also be drawn at the end of the muzzle raycast.

    A third person mode is in the works, though for first person, we would like to keep the current system of weapon model animation and positioning, with maybe the bottom portion of the player model being rendered so the player can see their legs, but still have the advanced weapon model features like scripted bobbing, swaying, recoil, and positioning, that are more difficult to achieve when rendering only a full player model in first person mode. We’ll be experimenting with this to see what produces the best results. Thanks for the feedback.


    No problem rcgmhds, Shkarface Noori has the right idea with using the Ignore Raycast layer. You might want to have a look at the landmine objects in the demo scene. The MineRadiusCollider objects have sphere colliders and are set to the Ignore Raycast layer.

    So for the ladder prefab issue, may I ask a few questions to get some more information about what might be happening? First of all, do you notice the FPS decrease when a single ladder prefab is added to the scene, or are there multiple ladder prefabs? Also, do you notice the FPS decrease with the player prefab in the scene as well, or is it only the ladder prefab(s)? I looked at Ladder.cs and there shouldn’t be any code being executed unless the ladder trigger detects a collision with the player object.

    The issue could be related to the fact that the ladder is composed of several scaled box objects, which isn’t optimal for draw calls and physics calculations in large numbers. The box objects should (and will) be replaced with a single ladder mesh that has one mesh collider component. Another thing to try, if the problem is not related to the ladder prefab, is to uncheck the box at the top of the WorldRecenter.cs component on the FPS Player object to deactivate this script, in case there is an issue with it attempting to reposition and refresh multiple terrains. Hopefully that might give you some ideas, but if you’re still experiencing the issue, please let us know.


    Hi sistematix, have you made many changes to the default project, or does this error occur in a blank, empty project with the asset newly imported? May I ask what target platform you are building for and what the run time library error says? This type of error sounds like it is separate from the compilation of the scripts in Unity and possibly has something to do with creating/finalizing the standalone package. Thank you for your patience.


    No problem DevGuy. For your GuiTexture question, it depends on the results you're trying to achieve. Scripting is usually needed to set up, modify, and draw the GUITexture. There are some built-in variables of the GUITexture component such as color, x y position, and border size that can be modified. Once you have a reference to the game object that the GUITexture component is attached to, you can edit these variables as needed. Does this answer your question?

    It is possible for the player to have a character model that casts shadows, but we currently haven’t implemented this feature yet. A script needs to be written that handles the positioning and rotation of the character model, while reading the movement and action states of the prefab and playing the appropriate animations of the character model.
     
    Last edited: Dec 11, 2013
  11. GageLucasDev2

    GageLucasDev2

    Joined:
    Jul 24, 2013
    Posts:
    77
    Yes that helps with he gui texture, but im not clear on how to implement the adding/subtracting of the texture when a player gets hit, or when the player regenerates health. Obviously i doubt you have time if the script is complicated but can you point me in the right direction so i can maybe hire someone or attempt to learn. Or i can just pay you for it, lol.

    Ok good to know about the shadow.

    *Another thing. Every time i SPRINT, the distant terrain kind of shifts up and down with the player. Why is this? I mean once i stop the sprint the terrain is static as it should be, but its every time i do this like the middle of the distant mountain bobs with me. I tried with world recenter on and off, if that helps?
     
  12. rcgmhds

    rcgmhds

    Joined:
    Feb 2, 2013
    Posts:
    21
    @ Azuline. Thanks for the input. I did some testing with another prefab (ShantyTown Wooden Tower) and adding/removing that had the same affect on performance. I'll play around with the ladder prefab by itself (I removed all of the cubes and left only the collider that manages the climbing) and will definitely let you know. To answer your question I only placed that tower and one ladder prefab in the scene, but as I said the scene is pretty big and it's been trial and error getting it to be performant (I'd love to know how to dynamically load terrains at runtime with all objects or children of the terrain being loaded as well).

    PS. To be concise, I'm not sure if it's the ladder prefab or that tower causing the issue; I believe it's the tower.
     
  13. shkar-noori

    shkar-noori

    Joined:
    Jun 10, 2013
    Posts:
    833
    make it a bit clear for the texture....what exactly do you want...maybe i can help u with it
     
  14. shkar-noori

    shkar-noori

    Joined:
    Jun 10, 2013
    Posts:
    833
    there cant be just a decrease because of a prefab...check if you dont have another object tagged as main camera...cause the ladder finds the FPSRigidbody walker component in EVERY OnTriggerEnter function and check if you have playerObj filled...if you dont fill playerObj with the right objectl... you get FPS decrease
     
  15. GageLucasDev2

    GageLucasDev2

    Joined:
    Jul 24, 2013
    Posts:
    77
    In turn, all i need is to switch the numerical health, thirst, hunger displays, into textures on the screen such as life bar, thirst bar and hunger bar. Then, i need these textures to react accordingly to the actual variables of those 3 so that when you get hit or fall etc, the texture will decrease(get smaller), and when you regenerate health, the texture will grow back to its normal size.

    Is this more understandable?
     
  16. sistematix

    sistematix

    Joined:
    Dec 26, 2012
    Posts:
    9
    not much just add some new npc's, some few lines so the npcs drop something when they die, add new raycast to the maincam, so i've create 3 scene, intro, loader and the main scene..on the standalone exe mode the 1st two scene's act normal but then when it reach the main scene it suddenly crash visual runtime library... the main scene runs normal on the editor
     
  17. OneShotGG

    OneShotGG

    Joined:
    Nov 16, 2012
    Posts:
    225
    Couple quick questions.

    With the addition of hunger and thirst (which is like a certain popular mod for a certain popular military game) do yall plan on adding a proper inventory in the future which *cough* dayZ cough* has?

    Also, lets say I wanted to change the way reloading works into a realistic "Clip" one. IE, each clip has so many rounds and when you change clips the remaining bullets don't just magically get reloaded. Would that be possible with this system?

    The reason I ask both of these questions is, the idea we are running with in our game is that the player has to manually reload clips in the inventory (ie. drag bullets 1 by 1 into the "emtpy" clip). When you reload a gun the script would read if there are clips with bullets in them and how many bullets the current clip has.

    So basically reloading switches out clips and these clips hold the bullet number which gets passed on to the gun script.

    The flow would go

    Player reloads pistol -> is there another pistol clip with bullets? -> if so select next clip and place current clip in inventory -> read amount of bullets in clip and add them to available bullets to fire -> each time a bullet is fired remove a bullet from the clip -> when clip is empty try to reload a new one and place the empty clip in the inventory.
     
    Last edited: Dec 12, 2013
  18. shkar-noori

    shkar-noori

    Joined:
    Jun 10, 2013
    Posts:
    833
    sure i can help... PM me
     
  19. GageLucasDev2

    GageLucasDev2

    Joined:
    Jul 24, 2013
    Posts:
    77
    Where can i find the script in the FPS pack that disables the cursor, or hides it? because i need it to show for inventory purposes on a key press and to hide on same key press.
     
  20. rob535

    rob535

    Joined:
    Dec 13, 2013
    Posts:
    18
    Hi, i'm using xbox 360 controller with Use Axis Input checked. I'ts working, but if i walk into a rigid body i cant back up, and sometimes it just keeps walking. I can walk away if i turn, but if the camera is facing the body it wont move.. any idea's? I'm using version 1.19

    Edit: I mean if i walk into a door or a wall with a mesh collider on it, i get that problem, but it can still strafe or turn.. It just wont walk backwards..
     
    Last edited: Dec 14, 2013
  21. rob535

    rob535

    Joined:
    Dec 13, 2013
    Posts:
    18
    Hi, i think that is in the SmoothMouseLook.cs line 57.
     
  22. GageLucasDev2

    GageLucasDev2

    Joined:
    Jul 24, 2013
    Posts:
    77
    Ah, any idea on how to make it lock movement camera when the pause button is pressed instead of just setting timescale?
     
  23. Azuline-Studios

    Azuline-Studios

    Joined:
    Apr 5, 2013
    Posts:
    203
    Hi DevGuy, you might want to have a look at this Unity Answers post with discussion on how to scale the width of a GUITexture element by a variable value. Maybe Shkarface Noori can help you too.

    As for the distant terrain bobbing with the camera, is the terrain object set to layer 10, the world collision layer? If it’s set to something else like layer 8, the Gun layer, you might notice problems. Also, the game object tag should be something like Dirt. Is the distant terrain you mentioned a Unity terrain object, or is it its own game object with a Mesh Renderer component? There might be problems with the WorldRecenter.cs script and mesh objects with varying LOD levels, which we are looking into. You mentioned that you already have tried deactivating the WorldRecenter.cs component, so maybe that’s not the issue. Please let us know if you still need help with this.


    That’s interesting, rcgmhds. For performance reasons, you’ll probably not want to use one scene as a whole ‘world map” unless you’re using occlusion culling and LOD for meshes. You might want to look into Application.LoadLevelAsync, as it can be used to stream the world as the player moves through it.

    Do you know what the triangle count is for the tower and if there are any scripts attached to it that might be causing the slowdown? Maybe you could try decreasing the world size around the tower and ladder prefab to see if you can reach a point where the slow down stops occurring, in which case, it is probably a triangle count (or possibly draw call) issue, which you’ll want to keep as low as possible. Checking that the layer of the tower object(s) is set to 10, the World Collision layer, and that the object tag is set to something like Dirt, would also be a good idea, as Shkarface Noori mentioned. Hope that helps.


    Hi sistematix, for the visual runtime library error, has the project fully compiled and the error occurs while running the standalone executable when you reach the main scene? Also, is there any specific text in the error window that you can paste so we can get a better idea of what might be happening? It might have something to do with the NPC or raycast changes that were made, but the fact that the scene runs correctly in the editor is odd. Have you tested the loader scene in the editor as well? Hopefully the error message will provide some more information on this. Thanks for your patience.


    Hi OneShotGG, a more complete, GUI-based inventory system is definitely on the list for a future update. That’s a neat reloading system idea. Most of the reloading code for the weapons is located around line 997 in the WeaponBehavior.cs script in the Reload() function. This code would need to be modified, but maybe you could look at the way shotgun reloading works, with shells being reloaded one at a time, and initiate this behavior from the GUI when the player clicks on the ammo and weapon/magazine icons.

    As far as tracking the ammo amounts for each magazine, an array could be created for each weapon/ammo type that holds integer values for the amount of bullets in each magazine. So the magazine array might have 3 indices in the list, to indicate there are three magazines, and each index would be an integer value of the number of bullets in each clip.

    When loading bullets in the mags by adding to the integer vars in the array, you could check a var like bulletsPerClip to ensure that the maximum bullet limit per magazine is not exceeded. I apologize that we don’t have a specific example on how to do this yet, but what I mentioned above would be a good start until the GUI-based inventory is implemented.


    Thanks for pointing this out rob535, this is a bug that we missed. To fix it you can change this statement starting around line 328 of FPSRigidBodyWalker.cs from this:

    Code (csharp):
    1.                     if((!hit2.rigidbody  grounded)){//allow the player to run into rigidbodies
    2.                         //zero out player y input if an object is detected in front of player
    3.                         inputY = 0;    
    4.                         //increase the y input lerp speed to allow the player to stop quickly and prevent overlap of colliders
    5.                         InputYLerpSpeed = 128.0f;
    6.                         if(FPSPlayerComponent.useAxisInput){inputYSmoothed = 0.0f;}
    7.                     }
    to this:

    Code (csharp):
    1.                     if((!hit2.rigidbody  grounded)){//allow the player to run into rigidbodies
    2.                         //zero out player y input if an object is detected in front of player
    3.                         if(!FPSPlayerComponent.useAxisInput){
    4.                             inputY = 0;
    5.                         }else{//if using axis/joystick input, allow player to backpedal away from obstacle, but still prevent forward movement
    6.                             if(Input.GetAxis("Vertical") < 0){
    7.                                 inputYSmoothed = Input.GetAxis("Vertical");
    8.                                 inputY = inputYSmoothed;    
    9.                             }else{//don't let player move completely forward into obstacles to prevent them from getting stuck
    10.                                 inputY = 0;
    11.                                 inputYSmoothed = 0.0f;
    12.                             }
    13.                         }
    14.                         //increase the y input lerp speed to allow the player to stop quickly and prevent overlap of colliders
    15.                         InputYLerpSpeed = 128.0f;
    16.                     }
    and it should fix the issue. Thanks again for the feedback, this change will be in the next update.


    Hi DevGuy, rob535 is correct in that you can add some toggle code to the Screen.lockCursor = false; and Screen.showCursor = true; lines of SmoothMouselook.cs which should allow the cursor to be locked and unlocked.

    As far as using a different var to check for pausing, you can try creating a Boolean var in the FPSPlayer.cs script called “paused” and toggle this var instead of setting timescale to zero. A lot of the other scripts would need to be updated to reference this var instead of the timescale value, as well as adding some new checks for the paused var to disable certain actions that otherwise would’ve been stopped when the timescale was set to zero.

    So you could go to the Search->Find in Files menu in MonoDevelop and search for Time.timeScale, which will bring up all the references to timescale in the scripts. Then you could change a reference that looks like this:

    Code (csharp):
    1. if(Time.timeScale > 0){//allow pausing by setting timescale to 0
    to something like this:

    Code (csharp):
    1. if(FPSPlayerComponent.paused){//allow pausing by setting paused var or FPSPlayer.cs to false
    ...after creating a reference to the FPSPlayer.cs component like this if there isn’t one already:

    Code (csharp):
    1. FPSPlayer FPSPlayerComponent = GetComponent<FPSPlayer>();  
    Implementing this feature would take some time, but it would be worth it and is something we’d like to do in a future update as well. Hope that helps.
     
  24. shanenine

    shanenine

    Joined:
    Dec 14, 2013
    Posts:
    3
    Hello, I'm still new to Unity and every thing but I've had your asset for awhile now and it's been great. I've started adding some melee weapons using the Katana object. I delete Katana,placed my new weapon and get it all lined up in the scene view. Looks good but when I play the weapon has lost it's alignment and is out in front of hands. I even tried moving the new weapon model back a little further to see if when played the movement would line it up but still goes to front of hands. Any ideals or help would be appreciated. Thank you for the great Asset and time saving deal:)
     
  25. reaperkan

    reaperkan

    Joined:
    Aug 5, 2013
    Posts:
    15
    How can i remove the thirst and hunger thingy from it?
     
  26. rob535

    rob535

    Joined:
    Dec 13, 2013
    Posts:
    18
    Thank's Azuline, that fixed it.. :D
     
  27. rob535

    rob535

    Joined:
    Dec 13, 2013
    Posts:
    18
    Hi reaperkan, just click on !!!FPS Player Main in the Hierarchy, then expand it, click on !!!FPS Player and look in the Inspector uncheck Use Player Hunger and Use Player Thirst..
     
  28. rob535

    rob535

    Joined:
    Dec 13, 2013
    Posts:
    18
    Hi, i have noticed when using xbox 360 controller, i can't strafe on an angle without it slowing down.. If i'm using regular charactor controller it moves the same speed in all directions, i hope this can be fixed, thank's!
     
  29. KingofMk98

    KingofMk98

    Joined:
    Oct 10, 2013
    Posts:
    63
    How do i go about changing the quality settings in the pause menu?
     
  30. reaperkan

    reaperkan

    Joined:
    Aug 5, 2013
    Posts:
    15
    @Rob thanks mate also i always get stuck on making a Peek script how do i make one and also Sliding and adding legs lol and adding the Bootcamp soldeir as an AI any ideas guys?
     
    Last edited: Dec 16, 2013
  31. bakhtiar93tiar

    bakhtiar93tiar

    Joined:
    Aug 31, 2013
    Posts:
    1
    please tell me how to change model ai
     
  32. GageLucasDev2

    GageLucasDev2

    Joined:
    Jul 24, 2013
    Posts:
    77
    Referencing the manual, it states this:

    Adding New NPCs
     
  33. GageLucasDev2

    GageLucasDev2

    Joined:
    Jul 24, 2013
    Posts:
    77
    Anyone know a reason why my ENEMY is not switching between WALK and RUN animations?

    When i enter the aggro range my NPC only plays the walk animation not his run animation.
     
  34. rcgmhds

    rcgmhds

    Joined:
    Feb 2, 2013
    Posts:
    21
    I haven't revisited that particular asset, but I can say that I'm running 25 1024x1024 terrains in the same scene at 100+ fps with 3-4 types of detail/grass with moderate density, approximately 60,000 trees, detailed heightmaps, and with high resolution splat textures; this is all without LoD or occlusion since Unity automatically culls anything outside of the camera frustum and you can set the render distance on trees and detail.

    Having said that I've been able to drop other assets with no trouble into the scene; that tower just gives me grief. I've yet to drop the ladder prefab into the scene by itself, but I'm pretty sure it's not the issue.
     
  35. reaperkan

    reaperkan

    Joined:
    Aug 5, 2013
    Posts:
    15
    [SUP]#pragma strict

    var leanAngle : float = 35.0;
    var leanSpeed : float = 5.0;
    var leanBackSpeed : float = 6.0;

    function Update ()
    {
    if (Input.GetKey("q")) {
    LeanLeft();
    }

    else if (Input.GetKey("e")) {
    LeanRight();
    }

    else
    {
    LeanBack();
    }
    }

    function LeanLeft()
    {

    var currAngle : float = transform.rotation.eulerAngles.z;



    var targetAngle : float = leanAngle;

    if ( currAngle > 180.0 )
    {

    currAngle = 360 - currAngle;
    }


    var angle : float = Mathf.Lerp( currAngle, targetAngle, leanSpeed * Time.deltaTime );




    var rotAngle : Quaternion = Quaternion.Euler( transform.rotation.eulerAngles.x, transform.rotation.eulerAngles.y, angle );
    transform.rotation = rotAngle;
    }

    function LeanRight()
    {

    var currAngle : float = transform.rotation.eulerAngles.z;
    var targetAngle : float = leanAngle - 360.0;
    if ( currAngle > 180.0 )
    {
    targetAngle = 360.0 - leanAngle;
    }
    var angle : float = Mathf.Lerp( currAngle, targetAngle, leanSpeed * Time.deltaTime );


    var rotAngle : Quaternion = Quaternion.Euler( transform.rotation.eulerAngles.x, transform.rotation.eulerAngles.y, angle );
    transform.rotation = rotAngle;

    }

    function LeanBack()
    {

    var currAngle : float = transform.rotation.eulerAngles.z;


    var targetAngle : float = 0.0;

    if ( currAngle > 180.0 )
    {
    targetAngle = 360.0;
    }


    var angle : float = Mathf.Lerp( currAngle, targetAngle, leanBackSpeed * Time.deltaTime );

    var rotAngle : Quaternion = Quaternion.Euler( transform.rotation.eulerAngles.x, transform.rotation.eulerAngles.y, angle );
    transform.rotation = rotAngle;
    }[/SUP]

    This is a script for leaning how can i apply this to the Realistic FPS prefab? :(
     
  36. stevedarby02

    stevedarby02

    Joined:
    Jan 4, 2013
    Posts:
    61
    Hi,

    Has anyone got a save script working with this prefab? Any help would greatly be appreciated.

    Thanks
     
  37. Devision4

    Devision4

    Joined:
    Jan 12, 2013
    Posts:
    1,329
    Hello Question. Im testing the prefab in a scene where all lights are baked. The arm and weapon are very dark, how to light them? thanks
     
  38. Devision4

    Devision4

    Joined:
    Jan 12, 2013
    Posts:
    1,329
    Oh and I have this error

    Mismatched serialization in the builtin class 'Mesh'. (Read 18376 bytes but expected 18377 bytes)
     
  39. Andy Charlie

    Andy Charlie

    Joined:
    May 31, 2013
    Posts:
    31
    Did you check if the animations have the correct names?
     
  40. GageLucasDev2

    GageLucasDev2

    Joined:
    Jul 24, 2013
    Posts:
    77
    yes all have the names
     
  41. Paddington_Bear

    Paddington_Bear

    Joined:
    Dec 9, 2012
    Posts:
    274
    So excited for Third Person view, when is it's release expected??
     
  42. Azuline-Studios

    Azuline-Studios

    Joined:
    Apr 5, 2013
    Posts:
    203
    Hi shanenine, good to hear you're enjoying the asset! There's a few things you might want to check with your weapon model. First, the mesh object should be set to layer 8, the Gun layer. If it's not, the weapon model will be pushed forward and unaligned as you've described. The mesh object should also be a child of either the deactivated katana mesh object (if the hands are still active/visible) or if you're using a completely new model, it should be a child of the main weapon object with the WeaponBehavior.cs component.


    Hi rob535, you might want to try increasing the Strafe Speed Percentage value of the FPSRigidBodyWalker.cs component to 1.0 (default is 0.8 ) This variable allows the strafing speed to be tweaked as well as the backpedal, zooming, and crouching speeds.


    To change the quality settings while in an active game, you can modify several variables from your pause script, KingofMk98. Here is a page that lists most of the quality options that should be changeable real-time.


    A few pages back there was some discussion on how to add a very basic leaning feature, reaperkan. This code still needs a raycast check to prevent the camera from clipping into walls, but that method is how we will be doing our implementation for the asset. For sliding, you might want to have a look at the included obstacle course demo scene, but instead of applying an upward force to the player capsule for climbing ledges, a horizontal force can be added to the player's total velocity. Hope that helps.


    You might want to try decreasing the private variable of AI.cs called minimumRunSpeed (default 3.0), DevGuy. When the NPC moves at a speed slower than this, they will play their walking animation, and at higher speeds the running animation is played. The speed var (default 6.0) can be changed as needed too.


    That's true how the camera clipping range can be used for optimization, rcgmhds. Maybe there is some other part of the scene that is being maxed out and the tower model doesn't work well in that situation? It's hard to say without looking at the scene, but maybe there's a way around it somehow.


    We've been talking with another user about Unity Serializer, stevedarby02, but there are some problems restoring the saved state with that project that we need to look into. Something we'd like to do further down the road, would possibly involve Unity's data writing functions and byte conversion to store the basic gameplay variables needed for a simple and fast save system in an external file.


    Hi Devision4, if all the lights in your scene are baked, does that mean you're using no real-time lights at all? By default the weapon models and NPCs use Unity's built in diffuse, bump, and specular shaders, which AFAIK require a light direction and magnitude to render the shading on the objects. Either you can just use one directional light that only lights these models, or you can change their shaders to use an unlit or some kind of vertex shaded, shader. This kind of setup would be more common for a project on a mobile platform, since the light rendering would be faster. I think this is probably the issue based on what you described, but if you still have questions, please let us know.

    For the mesh error, this thread has some discussion about it. Maybe you can try reimporting the assets to see if it resolves the issue.


    Thanks TheDuckOnQuack! I can't say for sure when the third person feature will be available, but it's definitely on our list. We've posted a simple example of what's possible by changing a few lines of code and TheOneshotGG has already implemented a full third person mode for their project. Our implementation will take some time as we want to do it right and make it customizable. We appreciate your patience.
     
    Last edited: Dec 19, 2013
  43. Deatructo

    Deatructo

    Joined:
    Nov 22, 2013
    Posts:
    8
    Quick question how do i setup gui textures for health im trying to get a battery on the ui with blocks that when my battery.level reaches a certaim % it will display a texture of green battery blocks for each percentage (10,25,50 etc..) but whenever i add the gui script it wont show up nothing will only the standard gui for health hunger ammo and thirst is the standard gui blocking it kindof new at this if you can help me get it working you can have the script asset for yoir prefab ots a flashlight with draining battery when it gets low it will flicker and a battery pick up to increase battery level
     
  44. Devision4

    Devision4

    Joined:
    Jan 12, 2013
    Posts:
    1,329
    Can I deactivate Hunger and Thirst?
     
  45. Deatructo

    Deatructo

    Joined:
    Nov 22, 2013
    Posts:
    8
    There should be a check box for hunger and thirst under fps player script in your hiarchy
     
  46. reaperkan

    reaperkan

    Joined:
    Aug 5, 2013
    Posts:
    15
    any eta on the next version?
     
  47. Devision4

    Devision4

    Joined:
    Jan 12, 2013
    Posts:
    1,329
    Ok I got the asset running in my scene. When I shot wall, I see no bulletholes. What do I need to setup to see them? Thanks!
     
  48. Devision4

    Devision4

    Joined:
    Jan 12, 2013
    Posts:
    1,329
    Can anybody tell me how to make a trigger to spawn Zombies? Thanks!
     
  49. rob535

    rob535

    Joined:
    Dec 13, 2013
    Posts:
    18
    Hi Azuline, i had already tried doing those adjustments... I got my strafe speed and walk back speeds the same as forward speed, but if i move the joystick into any one of the 4 corners, like i do if i'm running and i want to strafe while maintaining full run speed.. I can't, it just slows down to half speed... It doesn't do that on regular FPS prefab, oh well, i'll figure it out hopefully.. Thank's.. :)
     
  50. reaperkan

    reaperkan

    Joined:
    Aug 5, 2013
    Posts:
    15
    Hey Azuline can i get your skype name i always get stuck in doing something so i need your help ?