Search Unity

Mount Points

Discussion in 'Assets and Asset Store' started by Tryz, Mar 22, 2014.

  1. Teila

    Teila

    Joined:
    Jan 13, 2013
    Posts:
    6,630
    We have our own system for clothing but I was thinking of using it for weapons and tools held in the hands. I think I can see how it will work.

    I bought it before seeing this response but I can see other uses for this so I think it is fine. :)
     
  2. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,195
    If you caught my Hallow's Deep videos, I use MP for connecting the armor, sword, and bow. It works really good with weapons because you can call one function to connect something like a sword and it will be instantiated, connected, and rotated to fit based on your mount points.

    I also don't think you'll have an issue with UMA. One of my beta testers (for MC) uses UMA and he's pretty good about keeping me honest. I just know that UMA instantiates at run-time and I'm not that familiar with what UMA needs.

    Don't hesitate to email tim@ootii.com if you need help.
     
    Shawn67 and Teila like this.
  3. dtran123

    dtran123

    Joined:
    Mar 29, 2016
    Posts:
    2
  4. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,195
    Hi @dtran123 ,

    Thanks for the kind words. :)

    As for Mount Points and Inventory Pro, MP doesn't really care about the inventory aspect of things. It's all about connecting things together in the scene. So, there's nothing stopping them from working together, but there's nothing helping either.

    In my mini-inventory solution, I just have a path to the resource that is the armor or weapon and use that path to instantiate it on the character when the time comes.

    So, the key is really just having a string value associated with the inventory item that is the resource path. Then instantiating that resource using Mount Points. I'm not sure if IP lets you add a string value to its items. If so, you should be golden.

    I hope that makes sense.
     
  5. mdotstrange

    mdotstrange

    Joined:
    Sep 23, 2013
    Posts:
    208
    I'm interested in buying this asset just had a quick question-

    Right now for adding objects like melee weapons etc that the player picks up- I'm instantiating the game object then parenting it to the hand bone for example- then I'm re-positioning it/rotating it-

    I'm just switching the objects out- so there is a pickup version- if its "picked up" I despawn it and spawn the version to be attached to the hand bone-

    So If I used mount points would I not have to instantiate a new object to be placed in the hand? Could I just use the same object that I'm using as my pickup object- and mount points would handle the parenting/positioning etc? Sounds too good to be true :)
     
  6. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,195
    You can do it both ways.

    In the web demo, the existing sword is simply placed in the hand (no instancing):
    mMountPoints.ConnectMountPoints("Right Hand", GameObject.Find("Sword"), "Mount Point");

    However, with the helmet I create a new instance:
    mMountPoints.ConnectMountPoints("Head", "Prefabs/Armor/Helmets/Helmet", "Head");

    mMountPoints is the Mount Points monobehaviour of the parent object (the soldier).
    The first argument is the parent's mount point name.
    The second argument is the existing child GameObject or a resource path to instantiate.
    The third argument is the child's mount point name.

    In both cases, the child object positions and rotates so the mount points line up correctly.

    hahaha... It's true! :)
     
  7. mdotstrange

    mdotstrange

    Joined:
    Sep 23, 2013
    Posts:
    208
    Thx for the quick reply- just purchased it- thanks for the awesome tools!
     
    Tryz likes this.
  8. Bhanshee00

    Bhanshee00

    Joined:
    Jan 2, 2014
    Posts:
    35
    Hi there! I'm thinking of purchasing Mount Points but just want to ask a question (hopefully it hasn't been asked before). Is it possible to use this as a "poor mans" character creator? I'll explain:

    I plan on making some heavily stylised characters for my game, but I am particularly terrible at rigging and animating, so what I want to do is model a variety of individual body parts (think a kind of Rayman) and then attach them in various places to an animated model I already have. After that I want to hide the animated character, and thus the individual body parts will move and animate based on the underlying character. I hope that makes sense?

    Basically my question is, is it possible to attach objects to a character, hide said character but have the attached objects still visible and moving?

    Many thanks. :)
     
  9. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,195
    Absolutely.

    In fact, I'm doing the same exact thing. As a programmer, I'm using a single character rig, animations, and motion (Motion Controller) and swapping out body parts and equipment. The MP will handle skinned meshes as well as static meshes.

    But, there's a couple of things you'll have to think about...

    1. Mount Points won't "save" your character setup for you. In the editor, I just use Unity's normal prefabs and save scene system. However, you'll need to allow players to save their configurations at run-time. It's not really a MP issue as much as a "How will your game save game-data?" issue.

    2. When hiding the character, you just want to hide the skin (as needed). The bones (meaning the character itself and it's animator) need to stay active in order to be animated by Unity. Make sure you check out the MP demo as you can see I'm placing armor at run-time.

    http://www.ootii.com/Unity/MountPoints/Demo_01/index.html

    #1 is the biggie, but from MP's perspective, it will support what you want.
     
    Alverik likes this.
  10. Bhanshee00

    Bhanshee00

    Joined:
    Jan 2, 2014
    Posts:
    35
    Sold. That's exactly what I wanted. Purchasing as I speak. Thanks very much Tryz. :)

    Also as per your other assets on the store, I have to say I really like the inspector user interface that you use.
     
    Tryz likes this.
  11. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,195
    Thanks! :)
     
  12. frosted

    frosted

    Joined:
    Jan 17, 2014
    Posts:
    3,386
    How does the masking system work? Does it require specific shaders ?
     
  13. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,195
    Hi @frosted it requires a shader that supports transparencies, but that is all.

    I talk about that in the documentation. I can't get you the link right now, but you can get it from the assets Unity page.
     
  14. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    4,834
    @frosted - Check out pages 15-17 here.

    There is also a PDF specific to using Mount Point with skinned meshes here.

    The short answer is this:

    "To use this feature, your skin's material shader needs to support transparencies. I typically set the Rendering Mode to Cutout. For some characters like Morph3D and Mixamo, it means changing the shader your skin material uses."
     
    Tryz and Shawn67 like this.
  15. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,195
    I love helpful and friendly people. Thanks @hopeful
     
  16. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    4,834
    No prob! Hope you guys are having a good time on your vacation. :)
     
  17. krillmcrawl0

    krillmcrawl0

    Joined:
    Jan 13, 2014
    Posts:
    35
    Hi!

    Would this plugin work to fit a robber mask onto a head? I need the mask to respond/behave as cloth when the character is speaking. A mask similar to this:
    http://www.daz3d.com/ski-mask-for-m4

    Thanks!
     
  18. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,195
    If the mask is a skinned mesh that was tied to the facial bones, yes.

    However, if your facial expressions come from blend-shapes, then no. I believe Morph3D and Daz3D use blend-shapes for talking. So, that wouldn't work.

    I hope that helps. :)
     
  19. julianr

    julianr

    Joined:
    Jun 5, 2014
    Posts:
    1,100
    How easy would it be to enable snapping of two mount points on both ends of the weapon, so one hand snaps to the trigger point and the other hand to the barrel of the gun? I take it that the character would be constrained to these positions when running, so they don't break the mount point links?
     
  20. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,195
    It wouldn't really work like that.

    Attaching the gun to the right hand at the trigger point is fine.

    The issue is attaching the left hand to the barrel. The reason is that keeping it connected would require IK to bend the wrist, elbow, and even shoulder. Mount Points won't do any IK work like that.

    Typically it's the animation that keeps the hands in the right position. A single mount point would keep the gun connected to the hand.

    I hope that makes sense.
     
    julianr likes this.
  21. emrys90

    emrys90

    Joined:
    Oct 14, 2013
    Posts:
    489
    Any chance of allowing adding a skinned mesh at runtime with a reference to the instantiated object? Like we can do with adding it to a normal bone mount point, instead of requiring it to be in the Resources folder and needing a path. Same thing for passing in a reference to the texture for the mask.
     
    Last edited: Nov 3, 2016
  22. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,195
    I'll have to look at how that changes things.

    I went the resource approach because I assumed people would have different shirts, pants, etc. and I didn't want them all to have to exist in the scene to use Mount Points.

    When the item is taken off, it also allowed me to destroy the instance as I would just re-instantiate if needed.

    I'm in the middle of a project now, but in a couple of weeks I'll look to see how big of a change it is. Obviously the UI would change, but there may be other things under the hood.

    Is there a reason resources don't work for you?
     
    Last edited: Nov 3, 2016
  23. emrys90

    emrys90

    Joined:
    Oct 14, 2013
    Posts:
    489
    I'm integrating Mount Points into an existing project. My inventory structure is I have ScriptableObjects which are items that have a reference to a prefab and so on. My current code base is I instantiate the item and add it as a child to the player model.
     
  24. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,195
    The only difference than is that your prefab doesn't live in a "Resources" folder. Is that right?

    Since you can't access a prefab at runtime unless it's in the scene or a Resources folder, are you putting an instance of all your items/prefabs in the scene (or in the inspector of an object that is in the scene)?

    (I'm just trying to better understand how users handle this :) )
     
  25. emrys90

    emrys90

    Joined:
    Oct 14, 2013
    Posts:
    489
    My Item database is comprised of ScriptableObjects that are in the Resources folder. Each Item object has fields to set the prefab on it, so it gets included into the build. I think logically it makes sense to support using a GameObject reference for a skinned item because it would be more consistent with how you allow mounting items to a mount point bone.

    Overall it's not that big of a deal if you can't do it, I just finished making the necessary changes to support it. It would just be nice having it in there so I have less to deal with when upgrading your asset lol.
     
    Tryz likes this.
  26. emrys90

    emrys90

    Joined:
    Oct 14, 2013
    Posts:
    489
    How can I setup a bow to be able to be equipped on the left or right hand using mount points? I'm struggling trying to get the orientation correct for both hands. I have it looking correct for a sword, but I can't seem to find an orientation on the mount points where it looks correct for both swords and a bow.
     
    Last edited: Nov 3, 2016
  27. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    4,834
    Maybe you need to have left and right handed mount points on the bow ...?

    That may not be the only solution; it's been a while since I looked into MP and transferring weapons from one hand to the other. (I think I was looking at pistols, which ought to be a similar situation to the bow.)
     
  28. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,195
    You're dealing with 3 Mount Points: 1 on the bow, 1 on the left hand, and 1 on the right hand.

    I'll assume you've set the bow's MP up like I have it in the Archery pack:
    Blue forward arrow faces forward like one of the bow's arrows would when nocked.
    Green up arrow runs up the upper "arm" of the bow.

    Your hand mount points would be oriented so that:
    Blue forward arrow comes out of the fist, like your pointer finger if it were extended.
    Green up arrow comes out the top of your fist like your thumb if it were extended.

    When the bow attaches to the left or right hand, it will orient to fit either way.

    A couple of notes:

    1. The bow's mesh won't invert or flip, but you can place it in either hand.

    2. With the archery motion pack (if you're using that), I never built it to work in the right hand.
     
    hopeful likes this.
  29. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    4,834
    So the right hand MP and left hand MP should be positioned (one of them inverted, basically) such that the weapon's MP is neutral to both. (?)
     
  30. emrys90

    emrys90

    Joined:
    Oct 14, 2013
    Posts:
    489
    That got it pretty close, but there's minor adjustments still needed. Like it looks almost perfect for the bow, but on the sword's mount point I need to add about 20 degrees of rotation to the x orientation. The problem is for one hand it needs to be 20, for another it needs to be -20. If I modify the orientation for the hand mount points instead it then messes up the bow. How can I handle that?
     
  31. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,195
    Close. The weapon MP would be neutral, but I wouldn't invert one of the hands.

    Since we're dealing with rotations, you really can't invert one of them without having the bow go upside down or point at the character.

    Having the left and right MPs being roughly the same (not inverted) is typically fine for swords and and weapons that don't need to be flipped.
     
    Last edited: Nov 3, 2016
  32. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,195
    I'm not sure why the 20 degree rotation is needed, but if it's something that would effect everything in the hand, it should be part of the hand MP. If it is only needed on the sword for some reason (maybe the hilt and blade aren't straight), then I'd put the rotation on the weapon's MP.

    In my setup, the MP coming out of the hand is straight and the weapons have been with the exception of one or two. In those cases, I rotate the weapon's MP. With that, I can swap out a sword, dagger, hammer, bow, etc and they all pop in at the right position and rotation.

    There's nothing wrong with putting multiple handle MPs on your weapons (say for left and right). I just haven't found a need to do that yet.
     
    Last edited: Nov 3, 2016
  33. emrys90

    emrys90

    Joined:
    Oct 14, 2013
    Posts:
    489
    upload_2016-11-3_15-28-1.png
    upload_2016-11-3_15-28-32.png
    upload_2016-11-3_15-29-32.png
    upload_2016-11-3_15-30-24.png

    Maybe these images will help explain. I may be going about this wrong, I'm going off my best judgement for how I think it should be equipped in the hand without much experience in it. My thinking is that the angle of the sword should more match the angle of the players hand. If I do that though then the bow string winds up going through the players arm. If I change the angle on the sword mount point instead of the hand then for one hand it needs to be 20, another it needs to be -20, I'm guessing because of the inverted angle to align the bow correctly.
     
  34. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,195
    Ahhh, that does makes sense. Thanks :)

    I did have a similar issue with my bow. I think the difference between us is that I didn't need to put the bow in the other hand. So, I put that "yaw" rotation (to keep the string out of the arm) on the bow.

    In this case, I would have two MPs on the bow: "Left Hand Handle" and "Right Hand Handle". Since it's the bow "causing the problem", I would leave the hands themselves clean. Most of your other weapons should be clean too.

    As you go to mount the bow, you'll just have to determine the hand you're going in and choose the appropriate handle MP.
     
    mandisaw and hopeful like this.
  35. emrys90

    emrys90

    Joined:
    Oct 14, 2013
    Posts:
    489
    Okay thanks. I assume I'll need to use a Mount List instead of a Mount then, right?
     
  36. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,195
    Exactly. They work the same way.
     
  37. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,195
    Hi @mattockman ,

    A couple of questions...

    When you imported your clothing (skinned mesh), is it imported as a 'humanoid' rig?

    Are you sure your bone names are the same as in the character's skeleton?

    Is "Is Instance Visible" checked as well?

    If you just put the clothing in the scene, can you email me (tim@ootii.com) a screen shot of your character in the hierarchy (so I can see the child transform names) as well as a screen shot of the clothing so I can see its child transform names?

    I did double check my demo scene and everything is working. So, I'm sure we're just missing something small.
     
    Last edited: Nov 16, 2016
  38. devstudents

    devstudents

    Joined:
    Feb 18, 2014
    Posts:
    132
    @Tryz sorry, didn't realize there was a separate thread :)

    It's almost certainly got something to do with bones. In the past, I've simply modeled the item in question and then weight painted it to the armature. I would then export it as an FBX with the main character model and all would be fine. This wasn't a great system though as I needed all the assets to be on the character model, and I had to re-import the entire model whenever I wanted to add a new helmet!

    I think I need help with the steps from blender onward. I repotologised the high poly mesh and then parented it to the Mixamo skeleton with automatic weights. I then export it as an fbx with the entire armature. Since asking my question I can set it up so it instantiates on the model, but the mesh goes a bit a crazy. I think it would be too hard for me to explain the myriad of things that I'm potentially doing wrong so I've sent you a scene. Hope that's ok!
     
    Tryz likes this.
  39. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,195
    I'm not sure if you saw, but in the 'Assets\ootii\MountPoints\Extras' folder is a document called CustomContent.docx.

    There's also this page (which may be better):
    http://www.ootii.com/Unity/MountPoints/SkinnedMeshes.pdf

    They take you step-by-steps on preparing, importing, and using clothes.

    I use Marvelous Designer, Maya, and Unity. I haven't used Blender, but I think the steps will be similar.
     
  40. wood333

    wood333

    Joined:
    May 9, 2015
    Posts:
    599
    Hi Tryz,

    I used to use ORK Framework to handle my skinned mesh animations, but now I desire to animate my skinned meshes (clothes) outside of ORK , and with Inventory Pro. With Inventory Pro, I am able to get the clothes parented to the character, but, I would like to use Mount Points to make the clothes follow the character bones.
    I seem to recall a script you had for this purpose. Can you direct me to the script to use and do you have any tips on how to apply it in run time? Many thanks in advance.
     
  41. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,195
    Hi @wood333 ,

    Mount Points would instantiate the item (say pants) and assign the bones during that process.

    I talk about the function call in the User's Guide (page 13):
    http://www.ootii.com/Unity/MountPoints/MPUserGuide.pdf

    Basically, you're just calling the "AddSkinnedItem()" function.

    I hope that helps.
     
    wood333 likes this.
  42. emrys90

    emrys90

    Joined:
    Oct 14, 2013
    Posts:
    489
    When you import a skinned mesh, under the Rig tab there's an option called "Optimize Game Objects" which improves performance of animating the objects due to removing all the bone child objects. Does that not work with your asset for equipping skinned meshes?
     
  43. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,195
    The skinned mesh needs to match the bones you end up with in your character. So, as long as it doesn't get rid of bones that are in your skinned mesh or bones that are important for you animations, you should be fine.
     
    Shawn67 likes this.
  44. emrys90

    emrys90

    Joined:
    Oct 14, 2013
    Posts:
    489
    The bones are still there, but they are no longer game objects under the prefab of the model. Unity stores them internally or something instead of turning them into objects. I tried checking that box on a character and a piece of armor, but Mount Points gave an error when it loaded. Wanted to check if I was doing something wrong or if it's just not supported.
     
  45. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,195
    If Unity is storing them internally, than it won't work. I expect the bones to be transforms that I can access since I have to replace them in the skinned mesh.
     
  46. emrys90

    emrys90

    Joined:
    Oct 14, 2013
    Posts:
    489
    I figured as much, but just wanted to make sure before I gave up the possibility of better performance lol.
     
  47. christougher

    christougher

    Joined:
    Mar 6, 2015
    Posts:
    398
    I have several characters whose armor is just a submesh and has some bleed through. Would the skin mask be able to work in this instance where they are the same gameobject, just two meshes?
     
  48. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,195
    As long as you can set the body/skin's material to transparent or cutout, it shouldn't matter.

    That said, the system works when a skinned mesh is added to the character using AddSkinnedItem(). If your armor is already a sub-mesh, then you wouldn't actually need Mount Points to connect them. If that's true, then masking logic wouldn't run.

    Am I right in assuming the sub-mesh is just automatically part of the character during creation (meaning modeling)?
     
  49. christougher

    christougher

    Joined:
    Mar 6, 2015
    Posts:
    398
    You are indeed correct. One gameobject, two submeshes on the same armature. Rats!
     
  50. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,195
    Yeah, MP is great for attaching static meshes (swords, shields, etc) and skinned meshes (clothing, armor, etc). But, if you're stuff is automatically attached and doesn't needs swapping... than MP is probably overkill.