Search Unity

  1. Unity 2020.2 has been released.
    Dismiss Notice
  2. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

FPS Mesh Tool

Discussion in 'Assets and Asset Store' started by CodeBison, Jan 11, 2015.

  1. CodeBison

    CodeBison

    Joined:
    Feb 1, 2014
    Posts:
    246
    It's available in Google Docs format online here: https://docs.google.com/document/d/1wEq3hl1F72EZ6jHxstTGP2iF5ohpY8CtYlK9MMlP_YU (linked from Asset Store page). Please let me know if you have trouble viewing the images etc at that link.

    Cheers!
     
    JBR-games likes this.
  2. AscendanceGames

    AscendanceGames

    Joined:
    Jul 25, 2016
    Posts:
    8
    Have you had success creating first person arms with UMA as of yet?
     
  3. CodeBison

    CodeBison

    Joined:
    Feb 1, 2014
    Posts:
    246
  4. Rostomidss

    Rostomidss

    Joined:
    Dec 15, 2019
    Posts:
    1
    Hello, can anyone help me out with how to properly set FPS mesh tool hands with UFPS2 first person controller i am having a terrible hard time trying to find the correct position and also trying to find out why the hands are not working properly with UFPS state system.
    Here is a youtube link to what i am experiencing:
     
  5. CodeBison

    CodeBison

    Joined:
    Feb 1, 2014
    Posts:
    246
    There's a material handling component included with FPS Mesh Tool that's designed to work with the Opsive controllers during first/third person perspective switches, but it's not relevant for a first-person-only project. Your best bet regarding UFPS2 setup will be to ask on the Opsive forums. The FPS arms produced by FPS Mesh Tool are a standard Humanoid rig, so they'll have the same configuration requirements of any other humanoid rig. The Opsive crew will have a much better idea about what to do to sort out any configuration issues regarding positioning and state.
     
    JBR-games likes this.
  6. JimTheHermit

    JimTheHermit

    Joined:
    Oct 24, 2019
    Posts:
    22
    Does it work with Synty Polygon characters?
     
  7. CodeBison

    CodeBison

    Joined:
    Feb 1, 2014
    Posts:
    246
    Yup, it'll work fine with them.
     
  8. gearedgeek

    gearedgeek

    Joined:
    Jun 19, 2015
    Posts:
    197
    I'm getting this error when integration with UCC.
    Code (CSharp):
    1. Assets\CBG\FPSMeshTool_Integrations\Scripts\UCC\UCCFPSMaterialController.cs(28,13): error CS0103: The name 'EventHandler' does not exist in the current context
    2.  
     
  9. CodeBison

    CodeBison

    Joined:
    Feb 1, 2014
    Posts:
    246
    Which Opsive package do you have? Is it UCC, or one of the others like UFPS2 etc?
     
  10. gearedgeek

    gearedgeek

    Joined:
    Jun 19, 2015
    Posts:
    197
    Last edited: Apr 15, 2020
  11. gearedgeek

    gearedgeek

    Joined:
    Jun 19, 2015
    Posts:
    197
    Do I need to start with UFPS then import third person?
     
  12. gearedgeek

    gearedgeek

    Joined:
    Jun 19, 2015
    Posts:
    197
    I just tried importing just the UFPS: Ultimate FPS and I'm getting these errors. This is with the latest version 2.2
     
  13. CodeBison

    CodeBison

    Joined:
    Feb 1, 2014
    Posts:
    246
    It looks like version 2.2 of UCC will require a minor code change. I'll submit an update to the asset store. In the meantime, you can:
    • Open UCCFPSMaterialController.cs
    • Replace this line:
      Code (CSharp):
      1. using Opsive.UltimateCharacterController.Events;
    • With this:
      Code (CSharp):
      1. using Opsive.Shared.Events;
    And that should take care of it. Please let me know if you still have any problems after making this change.

    Cheers!
     
  14. gearedgeek

    gearedgeek

    Joined:
    Jun 19, 2015
    Posts:
    197
    That minor code fix has solved the issue. Thank you for the help.
     
  15. gearedgeek

    gearedgeek

    Joined:
    Jun 19, 2015
    Posts:
    197
  16. radiantboy

    radiantboy

    Joined:
    Nov 21, 2012
    Posts:
    1,147
    Hi, I am preparing a lot of models using this (maybe over 50, in order to get the head on its own for decapitation). Is there any way to automate it, or script it? I realise theres different types of models, but I have 25 zombies that are basically the same, so was thinking a generic set of settings would work on them all. I havent check the code yet, just wondering what you would say. Thanks for the tool, I literally couldn't work without it.
     
  17. CodeBison

    CodeBison

    Joined:
    Feb 1, 2014
    Posts:
    246
    If you're adventurous, you could definitely make a script process a bunch of meshes automatically, for sure. If you're familiar with editor scripting at all, you'll find everything you need to know in FPSMeshToolWindow.OnGUI(). You could fairly easily add a gameobject array property to the window, and add a button that drops them each in the appropriate slot and calls the required methods to process them in order.
    (Please forgive the messy code while you're in there - it's not really designed to be touched by end users, so it's full of ugly hacks)
     
    JBR-games and radiantboy like this.
  18. radiantboy

    radiantboy

    Joined:
    Nov 21, 2012
    Posts:
    1,147
    That's exactly what I needed to hear, not oh it's a DLL. CodeBison you remind me of UFPS hack days, u were there werent you?I will navigate like a queen and maybe post back here multiple processing "haccka". Respect to all you code lords reading this.

    Thanks mate, legend.
     
  19. CodeBison

    CodeBison

    Joined:
    Feb 1, 2014
    Posts:
    246
    Oh man, no, dll-only assets are lame. You've got to be able to change the code to suit your needs.

    Been a fan of UFPS for ages. When they added full body presence, that was the inspiration for FPS Mesh Tool - I didn't want to have to manually edit my meshes for first/third person. I looked around to see if someone had made an automated solution. Turns out nope, nobody had. And here we are.
     
    JBR-games likes this.
  20. somosky

    somosky

    Joined:
    Feb 15, 2014
    Posts:
    135
    Hi CodeBison quick question. I'm attempting to use your tool with a Synty asset and Ultimate Character Controller. Everything is working fine for the normal use cases. I can separate the arms/ head / body etc and switch them on and off by switching views on the Ultimate Character Controller. I am having one issue though. Synty characters come with several skinned mesh renderers in the prefab so you can simply turn one off and turn another one on at playtime to switch between characters. I'm having issues loading the materials into the UCCFPS Material Controller because it appears to only be set up to switch the materials for one skinned mesh renderer. Is it possible for it to support multiple or switch them at runtime?
     
  21. CodeBison

    CodeBison

    Joined:
    Feb 1, 2014
    Posts:
    246
    I've replied in email, but I'll put the answer here too, as I think it might be useful for others (I love Synty assets, BTW - hard to beat them for style and quality)

    If I understand you correctly, you should be able to do this without much trouble. Depending on the exact functionality you're looking for, the material handler might work for you exactly as is, or you might have to adjust it a bit.

    The (UCC)FPSMaterialController does support making changes to materials on multiple renderers, and by default it will try to find all renderers on the gameobject it's on. In order for it to successfully find them, however, you'd need to have all the characters turned on while you're configuring it. This should be as simple as going through all the Synty character objects and setting their gameobjects active. Then if you right click the material controller and select Reset, it should find all the renderers inside it. You can then disable whichever ones you don't want to start active (or use the Synty switcher etc), and it will still know about all the disabled ones. That should be enough to get you up and running, though it will be a bit inefficient. It'd be worth testing to make sure this is functional before going any further. If it is, great! If not, let me know what is/isn't working and we can figure out what might be wrong.

    Once you've (hopefully) got this working, and characters are able to switch properly at runtime, we'll want to optimize. If you look in FPSMaterialManager (the UCCFPSMaterialManager inherits directly from this), you'll see the SetBodyPartVisible function:

    Code (CSharp):
    1. void SetBodyPartVisible(FPSBodyPart part, bool visible) {
    2.     foreach (var rendEntry in materialData) {
    3.         var mats = rendEntry.renderer.sharedMaterials;
    4.         var indices = rendEntry.matLookup[part];
    5.         foreach (var index in indices) {
    6.             mats[index] = visible ? rendEntry.originalMaterials[index] : invisibleMaterial;
    7.         }
    8.         rendEntry.renderer.sharedMaterials = mats;
    9.     }
    10. }
    You'll notice the function goes through every single renderer it knows about, and reassigns all its materials. Since most of the renderers will be disabled in your case, this is really wasteful. You'll want to make a change something like the following (line 3 below), to ensure we skip over all the disabled renderers:

    Code (CSharp):
    1. void SetBodyPartVisible(FPSBodyPart part, bool visible) {
    2.     foreach (var rendEntry in materialData) {
    3.         if (!rendEntry.renderer.enabled) continue; // skip the renderer if it's disabled
    4.         var mats = rendEntry.renderer.sharedMaterials;
    5.         var indices = rendEntry.matLookup[part];
    6.         foreach (var index in indices) {
    7.             mats[index] = visible ? rendEntry.originalMaterials[index] : invisibleMaterial;
    8.         }
    9.         rendEntry.renderer.sharedMaterials = mats;
    10.     }
    11. }

    You could take the optimization farther if you wanted, by doing something like keeping a list of only the enabled renderers, but this will be a good start.
    Hopefully that gives you the information you need. Please let me know if you have any questions or run into any trouble getting this sorted out.

    Cheers!
     
    JBR-games likes this.
  22. mait76

    mait76

    Joined:
    May 24, 2020
    Posts:
    9
    I tried the plugin on multiple characters exported from iClone, Character Creator 3, and 3DXChange and followed all instructions with no luck.
    For some reason, the character preview is all pink (see attached). Therefore, it can't identify the head, arms, and the rest of the body.

    Any clue?
     

    Attached Files:

  23. CodeBison

    CodeBison

    Joined:
    Feb 1, 2014
    Posts:
    246
    Are you using URP or the HDRP, by any chance? If so, you'll need to convert the preview materials to work with your chosen pipeline. The command will be something like Edit -> Render Pipeline -> Upgrade Project Materials to <name of your render pipeline>. Here's a Unity doc page with a bit more information: https://docs.unity3d.com/Packages/c...versal@7.1/manual/upgrading-your-shaders.html

    If you're not using URP or the HDRP, it could be that the materials with FPS Mesh Tool need to be reimported. You can do this by right-clicking on the CBG folder in your project and selecting Reimport.

    If this doesn't help, please let me know.
     
  24. mait76

    mait76

    Joined:
    May 24, 2020
    Posts:
    9
    I'm using URP. I upgraded the project materials as you said and it worked perfectly!

    Many thanks for the outstanding asset and quick reply.
     
    CodeBison likes this.
  25. mait76

    mait76

    Joined:
    May 24, 2020
    Posts:
    9
    I have Opsive UCC and followed your steps on youtube "
    " to set up my character for FPS & TPS. at time 0:50 you drag and drop the UCCFPSMaterialController script in the character as a component.

    When I add the script at the bottom of the character inspector I get an error "Can't add script component 'UCCFPSMaterialController' because the script class cannot be found. Make sure that there are no compile errors and that the file name and class name match".

    If I add it at the top of the inspector I get an error "Please fix compile errors before creating new script components".

    I checked the console and found the following msg:

    Assets\CBG\FPSMeshTool_Integrations\Scripts\UCC\UCCFPSMaterialController.cs(28,13): error CS0103: The name 'EventHandler' does not exist in the current context.

    Note that I'm not using the demo scene of Opsive.
     
  26. CodeBison

    CodeBison

    Joined:
    Feb 1, 2014
    Posts:
    246
    Namespace for Opsive's event handler changed in version 2.2. It looks like I somehow didn't complete the upload on the fix when I found out about the change back in April. Sorry about that.
    In the meantime, you should be able to get everything working by making the quick edit described here: https://forum.unity.com/threads/fps-mesh-tool.290351/page-6#post-5719414

    Please let me know if this doesn't sort everything out for you, or if you have any issues or questions.

    Cheers!
     
  27. mait76

    mait76

    Joined:
    May 24, 2020
    Posts:
    9
    That worked for me. thanks!

    I have three questions and I'm not sure if I should ask you or Opsive!

    1- When I set up the character for FPS & TPS in UCC using FPS Mesh Tool, I noticed the hidden parts are pink instead of transparent. I know the UCCFPS Material Controller is using "Invisible Material" from UCC but I don't know why it's pink!

    2- When I try to create an item in UCC "Item Manager", it requires "First Person Base" and in this case, the arms. What's the best way to fill this requirement? I tried to create the arms separately in the FPS Mesh Tool then use it as the first person base but it didn't work. When I play the scene I see the arms far away and even when I reposition them they don't show up in the cam. Am I doing the right thing? Any suggestion?

    3- When I play the scene, the first-person camera (under the main camera) turns blue and nothing is visible. It works when I change render type from "Base" to "Overlay" but I'm not sure if this is the right way to fix it. I probably need to redirect this question to Opsive but I thought of asking you since you're an expert and probably know the solution.
     
  28. mait76

    mait76

    Joined:
    May 24, 2020
    Posts:
    9
    I have one more note:

    If I add the arms that I created in FPS Mesh Tools in the character setup of the UCC for the FPS and play the scene, the arms disappear. When I checked the inspector, I noticed that the 'UCCFPSMaterialController' component had added the elements of the arms as well. Note that the arms become fathered by the character upon character creation. Might that be the reason why the arms disappear? if so, any way around this issue?
     
  29. CodeBison

    CodeBison

    Joined:
    Feb 1, 2014
    Posts:
    246
    1 - Pink would normally indicate an error with the shader. If you're using URP, I'd normally suspect the material isn't correctly configured. Since UCC has URP support, I think the best bet there will be to verify that the material controller is indeed using the correct material (this should be the case, as it searches for the material on the UCC components, but you should be able to verify by checking that the correct material is in the field of the material controller), and that you've taken any actions required on the UCC side of things to prepare your character for use with URP (eg if you have to drag a different material into the UCC components or anything like that). I confess I don't know much about how UCC handles integration with URP, beyond what I found here: https://opsive.com/support/document...-controller/camera/universal-render-pipeline/

    2 and 3, as well as your follow up comment about the arms disappearing, would probably be best answered on the Opsive side of things. The arms-only mesh FPS Mesh Tool creates for use in first-person is a standard humanoid rig, and doesn't have setup requirements different from any other humanoid rig. Justin and the Opsive crew will be a lot better suited than me to address any issues related to the configuration process. That said, I did find this video that some other people have found useful. It might help:


    Cheers!
     
  30. mait76

    mait76

    Joined:
    May 24, 2020
    Posts:
    9
    Thank you very much for the info. I fixed some of the issues and working on the rest.

    Just a quick comment:

    I saw you updated the asset however, I think you need to fix that line again.

    In version 1.2.7: you typed "Using" twice as follow:

    Using Using Opsive.Shared.Events;

    I'm sure it's a typo. Just thought of letting you know.

    Thanks again.
     
  31. CodeBison

    CodeBison

    Joined:
    Feb 1, 2014
    Posts:
    246
    LOL thanks for catching that! Guess I've got more uploading to do.
     
  32. Weendie-Games

    Weendie-Games

    Joined:
    Feb 17, 2015
    Posts:
    63
    I use this since the first version of UFPS and it is a great tool, thank you!

    I have suggestions to improve it:
    • Ability to select the folder where the meshes will be saved.
    • Ability to change the pivot point of the final mesh (This would be awesome to create arms like the UCC nolan character)
     
  33. CodeBison

    CodeBison

    Joined:
    Feb 1, 2014
    Posts:
    246
    Thanks for the suggestions!
     
    Weendie-Games likes this.
  34. JimTheHermit

    JimTheHermit

    Joined:
    Oct 24, 2019
    Posts:
    22
  35. JimTheHermit

    JimTheHermit

    Joined:
    Oct 24, 2019
    Posts:
    22
    OKay, easier question. How do I fix this? Third Person arms are still visible in First Person Perspective. When I put the script UCCFPSMaterialController, on the player, it makes ALL the arms disappear for FPP and changing the values in it, doesn't do anything.
    help.png
     
    Last edited: Jul 9, 2020
  36. CodeBison

    CodeBison

    Joined:
    Feb 1, 2014
    Posts:
    246
    Can you share a shot of what the UCCFPSMaterialController component looks like with all its fields expanded?
     
  37. JimTheHermit

    JimTheHermit

    Joined:
    Oct 24, 2019
    Posts:
    22
    I moved on and deleted that test. I still can't remove 3rd PP arms from the 1st PP view. This has the UFPS only installed, the FPS Material Controller script and a empty game object on the player with the Body Part Hider. You know, your program doesn't allow me to choose exactly what parts I want to hide- just a list of 4 things "head, body, arms, or legs" And "arms" don't work.
    extra arms.png
     
  38. CodeBison

    CodeBison

    Joined:
    Feb 1, 2014
    Posts:
    246
    It's hard to tell what's wrong from those screenshots. There are two things I can think of that are the most likely causes, though. The first is if the mesh creation didn't happen properly, and the second would be if the UCCFPSMaterialController component isn't properly configured.
    In edit mode, are you able to drag the invisible material over the third person arms and have the arms disappear? If so, that part is probably configured correctly. If not, we'll want to start by making sure we correct any issues with the basic character creation.
    Just in case it's not clear, you'll need two versions of your character processed by FPS Mesh Tool. One that includes only arms (which it looks like you have), and one that includes the whole body, but with the different body parts using different materials. This is what allows the FPS Material Controller to toggle different body parts on and off during gameplay.
    If your character base mesh is set up right, and you're able to make the arms disappear manually by dragging the invisible material onto them, we'll want to make sure the UCCFPSMaterialController component is properly configured. For details on that part, you'll want to check the FPS Mesh Tool manual. The section named FPS Material Controller has the details on this component, but basically you want to make sure that the material entries for each body part are correct (each material entry has the correct body type, etc). By default this should be correct, but there's always a chance something went wrong somewhere.

    If you're having problems with any specific part of this process please let me know and I'm happy to walk you through and help fix whichever bits aren't working as intended.

    Cheers!
     
  39. JimTheHermit

    JimTheHermit

    Joined:
    Oct 24, 2019
    Posts:
    22
    Yes. But, they still invisible in 3rd person mode. I'll go through the manual again.
     
  40. JimTheHermit

    JimTheHermit

    Joined:
    Oct 24, 2019
    Posts:
    22
    I don't understand any of this. BTW, I have a choice or Left Arm, Left Arm 1, Left Arm 1 1, Right Arm, Right Arm 1, and Right Arm 1 1.
    confusion.png
     
  41. CodeBison

    CodeBison

    Joined:
    Feb 1, 2014
    Posts:
    246
    Sorry for the delay responding to you - I'm in the middle of moving and it's hard to get to a computer at the moment.

    Can you send a copy of your current character prefab to me at support@codebison.ca? I'll load it into a fresh project and see what's up with it and why it's not cooperating.

    In case you're not familiar with the process, you can create a file with everything needed to test your character by right-clicking the prefab in your project hierarchy and selecting Export Package. The default settings will include everything needed for me to test your character.

    And just to clarify, you have only UFPS in your project at the moment?

    Cheers!
     
  42. CodeBison

    CodeBison

    Joined:
    Feb 1, 2014
    Posts:
    246
    Oh sorry, I just realized that's the FPSMaterialController component you're using, not the UCCFPSMaterialController component. Would you be able to give it a try with the UCCFPSMaterialController component instead? The FPSMaterialController requires you to write code to make it toggle materials - the UCCFPSMaterialController knows how to listen for first/third person view switching and will toggle materials automatically.

    If using the UCCFPSMaterialController component instead doesn't resolve the issue, if you could send me a copy of your character as described in the post above, that'd be great.

    Cheers!
     
  43. JimTheHermit

    JimTheHermit

    Joined:
    Oct 24, 2019
    Posts:
    22
    I sent the file
     
  44. CodeBison

    CodeBison

    Joined:
    Feb 1, 2014
    Posts:
    246
    Sounds good! I'll be able to look at it tomorrow. Thanks for your patience. :)
     
  45. CodeBison

    CodeBison

    Joined:
    Feb 1, 2014
    Posts:
    246
    I sent you details for the fix, as well as an updated version of FPS Mesh Tool. Please let me know if there's anything else I can do to help.

    Cheers!
     
  46. Nyphur

    Nyphur

    Joined:
    Jan 29, 2016
    Posts:
    37
    The tool doesn't sense-check file names before trying to create files using AssetDatabase.CreateAsset, and it doesn't fail gracefully if that method fails. Instead it throws an error on FPSMeshToolWindow.cs line 578 stating that asset creation failed and the progress bar stalls. You have to close the window manually and delete the generated character and all the generated files to make it stop.

    Unfortunately, Unity has provided very poor documentation on the CreateAsset method so there's no exhaustive list of what makes a file name invalid. The problem in my case is that there's a special character (a colon) in one of my mesh names, and your GenerateMeshFileName method just uses the sharedmesh name raw. Adding a quick string replace to remove special characters solved the bug.
     
    JBR-games likes this.
  47. JBR-games

    JBR-games

    Joined:
    Sep 26, 2012
    Posts:
    644
    i believe i had a similar issue with one of the infinitypbr characters.. would continually freeze up on a certain shirt mesh everytime. Still think FPS Mesh tool is great though..
     
  48. hengeworks

    hengeworks

    Joined:
    Oct 3, 2016
    Posts:
    11
    Using UCCFPS Material Controller, my third-person head/arms seem to be reappearing after respawn while in first-person. Any idea what might be up with that?
     
  49. CodeBison

    CodeBison

    Joined:
    Feb 1, 2014
    Posts:
    246
    I'm not sure what would be causing that off hand. Does everything go back to normal if you toggle to third person and back to first person? If so there might be another event that UCCFPSMaterialController needs to be paying attention to in order to ensure correct settings on respawn.
     
  50. hengeworks

    hengeworks

    Joined:
    Oct 3, 2016
    Posts:
    11
    Yes, that's been my workaround so far.
     
unityunity