Search Unity

Mount Points

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

  1. christougher

    christougher

    Joined:
    Mar 6, 2015
    Posts:
    413
    Well I was looking to buy it anywho, just thought it might also help my bleeding mesh problem.
     
    Tryz likes this.
  2. henmachuca

    henmachuca

    Joined:
    Oct 14, 2016
    Posts:
    95
    Hello there! Does it work with uMMORPG?! If so could you do a video or something to explain how does it work and how to make it actually change our armors inside the game?
    Thank you
     
  3. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,222
    Hi! Unfortunately, I haven't used MMORPG and I'm not really familiar with it.

    I just went to the page and it's got a lot going on. I'm not sure how they deal with animations and character controllers.

    The MC (and most all my assets) work well with any other asset. In the case of the MC, it's managing the animations and is the character controller for both PCs and NPCs. I see uMMORPG says "Animations via Mecanim". That may be an issue as you don't want two different systems controller the flow of animations.

    That's not much to go on, but I just don't know. :(
     
  4. Hamesh81

    Hamesh81

    Joined:
    Mar 9, 2012
    Posts:
    405
    Hi @Tryz , I need functionality very similar to Mount Points in order to be able to switch out skinned clothing meshes at runtime. With the mask system, does the mask make the occluded parts of the character transparent or are the occluded triangles actually culled by the shader?
     
  5. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,222
    Hi @Hamesh81,

    Using a transparent or cutout shader, I make part of the skin texture transparent. Which becomes transparent is based on the mask you create.

    Check out page 17 of the documentation. I explain the process and show some examples. :)

    I don't do anything with the mesh or camera.
     
  6. Hamesh81

    Hamesh81

    Joined:
    Mar 9, 2012
    Posts:
    405
    Ok thanks :)
     
  7. Banksy

    Banksy

    Joined:
    Mar 31, 2013
    Posts:
    310
    I'm trying to develop a game similar to Kerbal Space Program where the player builds rockets by snapping parts together like Lego bricks.

    Q. How would I go about dragging an object during run-time into close proximity to another point so it snaps to that point ?

    Q. Is it possible to rotate an object before snapping it when in close proximity.

    Any help would be greatly appreciated
     
  8. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,222
    Hi @Banksy

    I don't have logic to snap objects at run-time since the UI for that would be very game specific. However, I'm just doing a distance check and calling a function. You can check out the logic I use in the editor and do something similar.

    Check out MountPointsEditor.cs line 918. You'll see three functions that I use:
    FindSnapPoints()
    TestAndBreakConnections()
    ConnectMountPoints()

    Mount Points will force the child object to snap to the parent. That snap effects the position and rotation based on how you setup the Mount Points at edit-time. So, any rotation that happens before snapping will be ignored by the snap.

    You could add logic that ignores the snap or allows for Mount Point rotation, but that isn't something that exists today.
     
  9. Banksy

    Banksy

    Joined:
    Mar 31, 2013
    Posts:
    310
    Thanks so much for the speedy reply,

    So in essence Mount Points is tailored towards characters... if I wanted to create a creative style game ( Lego ) I might be better to use "Snap & Plug "

    I was hoping to drag and snap at run-time

    p.s - love the work you've done on Bone Controller.
     
    Tryz likes this.
  10. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,222
    It can be used with all different types of games that expect snapping, but for MP "snapping" means position and rotation. That just may be more restrictive than you want.

    Here's a video of someone using it for a race track. They implemented the run-time snapping to fit their game:


    Thanks for the kind words. :)
     
    TeagansDad likes this.
  11. devstudents

    devstudents

    Joined:
    Feb 18, 2014
    Posts:
    132
    Hello! I'm trying to understand how Mount Points works. If I simply parent the clothes prefab to the body, it doesn't animate at all or, if I play around with rig types and add the animator controller to each prefab, it animates but it is out of sync and misses certain animations. Here's what I mean (this is with the same prefab settings as the Mount Points model: generic rig, created own avatar, no controllers in animator):

    upload_2017-1-9_15-36-6.png


    So I'm assuming that Mount Points doesn't merely instantiate a prefab and make it a child of the character in question, or have I missed something obvious?

    Another question: when Mount Points is active, it takes about 20 seconds to load the scene. It usually takes one or two seconds without Mount Points. How can I improve this?

    Thanks again for the great asset!
     
    Last edited: Jan 9, 2017
  12. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,222
    Skinned meshes are different than static meshes and can't just be parented. The bones need to match.

    In the Users Guide (page 13), I talk about the functions to call in order to attach/remove the skinned meshes to/from your character. Simply making it a child doesn't attach the bones.

    If you're not using the UI and "Instantiate On Start", you'll have to call AddSkinnedItem() and RemoveSkinnedItemFromPath() when your game needs to add/remove clothing. I do extra logic to attach the bones (assuming they are from the same skeleton... which is a requirement for skinned meshes).

    That's odd. I'm not seeing this and no one else has reported it. Are you sure it's Mount Points?

    The only thing I can think of is if you have a ton of skinned meshes instantiating on start, Unity needs to load those assets when the game starts. Other than that, MP doesn't do any initialization or loading.

    Any info you can give on your MP setup might help. Are you on a PC or mobile?
     
    Last edited: Jan 9, 2017
    devstudents likes this.
  13. devstudents

    devstudents

    Joined:
    Feb 18, 2014
    Posts:
    132
    Thanks for the reply. I know about the calls for add/removing skinned meshes, I guess I just wanted to see if this behavior could be easily replicated without Mount Points. I'm definitely using Mount Points in my final project, but I've realised that I'll need professional consultation along the way. I understand that I can't send my complete project to someone if they don't own one of my paid assets, so I wanted to make a slightly crap but functional version of my project for consultation purposes that includes free alternatives to my paid assets (NavMesh instead of Apex, my crappy camera instead of RTS camera Pro, ? instead of Mount Points etc). However your response gave me the impression that the logic of it is beyond my current programming ability, so I'll just have to either A) not include this aspect of my project, or B) buy the guy a license (I'm leaning towards B).

    Yes pretty certain that it's Mount Points. I just have to disable the Mount Points script and the scene starts in a second or two, otherwise it's a 15 second wait. Alternatively I can uncheck 'instantiate on start' on the items I have at the moment, and then it starts in a normal amount of time as well.

    I only have three prefabs that instantiate on start so that can't be the issue. However the time increases for every item that is assigned to instantiate on start. When one item is selected it takes 5 seconds, two items take 10 seconds, and three items take 15 seconds.

    I'm running Unity on a relatively decent PC.

    Happy to send my project if that would help. All the rigs are generic.
     
  14. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,222
    So, that's interesting.

    That means that the delay is Unity loading the resources so they can be instantiated. It's just odd that others aren't seeing the issue, but it could be a factor of how complex your materials, textures, and skinned meshes are. I've just never seen it take 5 seconds per item. :eek:

    Try this... Take the three skinned meshes that are being created by Mount Points and drag them into the scene. For now, just put them anywhere. This way Unity has them loaded in the scene at start up already.

    Then, try running your tests (with "Instantiate on Start" off and then on). If they are already in the scene, Unity shouldn't have to load the resource.
     
    devstudents and hopeful like this.
  15. devstudents

    devstudents

    Joined:
    Feb 18, 2014
    Posts:
    132
    OK, just not quite sure how to do that. I tried dragging the prefabs into the scene but it ignored them. So then I noticed the instance option under skinned meshes. I clicked that and it instantiated the mesh into the scene during edit mode (took about 4 seconds), but then I couldn't disconnect the instances from the mesh, even if I unparented them. Was this what you meant though?

    This does seem to work, however. With the meshes already in the scene, the scene starts in a few seconds. The problem is that when I remove the clothing item and add it again in game, it still takes 4ish seconds and the game freezes while it tries to load it. I can't seem to escape this slow load time issue.
     
    Last edited: Jan 9, 2017
  16. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,222
    You should be able to drag and drop the skinned meshes into the scene like you do your character. If you can't, that's sort of scary... That means Unity is having an issue just loading the raw meshes.

    Go ahead and email me your skinned meshes and I'll look at them. Just send them to tim@ootii.com.
     
  17. devstudents

    devstudents

    Joined:
    Feb 18, 2014
    Posts:
    132
    I can drag them in from the resources folder, but I'm not sure how to do it from the Mount Points GUI -other than to use the instance button. I'm just uploading a very minimal project to google drive now. I'll share it with your address. I appreciate the help.
     
  18. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,222
    No problem. I just emailed you what I found.

    For anyone following the thread, you really want to make sure your skinned meshes have the minimum amount of bones possible. Typically a shirt or pair of pants would have 10-15 bones. If your character has 450 bones and your shirt has 450 bones, it will take some time to compare the bones, find the matching pairs, and attach them.

    This is just good practice in general... even without Mount Points. :)
     
    devstudents likes this.
  19. devstudents

    devstudents

    Joined:
    Feb 18, 2014
    Posts:
    132
    I got rid of my Rigify rig, made my own from scratch in Blender, deleted all the unnecessary bones on the clothing items, and now it works beautifully.

    Thanks for your help! I finally have a decent skinned mesh changer. I've wanted this since early 2014 :)
     
    Tryz likes this.
  20. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,222
    No problem! That's great. :)
     
    devstudents likes this.
  21. devstudents

    devstudents

    Joined:
    Feb 18, 2014
    Posts:
    132
    Hey Tryz. Just have a question about seats/licenses. I mentioned this before but I'm still unsure, and the situation is made even more confusing by the fact that I can't see any 'buy additional licenses' options in the asset store page.

    What are the legalities around sending someone your project for professional feedback if they do not own Mount Points? Would you have to purchase an additional seat for the consultant? If so, how do you do that and how much is it?
     
  22. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,222
    Licensing and seats really comes out of Unity's Asset Store licensing and usage policy.
    https://unity3d.com/legal/as_terms

    Section 3.5:
    Unless you have been specifically permitted to do so in a separate agreement with Unity and except as permitted under the Unity-EULA, you agree that you will not reproduce, duplicate, copy, sell, trade or resell any Asset that you have acquired from the Unity Asset Store for any purpose.


    I think you're not seeing the "buy additional license" because it's not under the "Editor Extensions" category. When not under that category, the individual has to buy the asset from their account. I should probably move it...

    The problem is that "consultant" creates a lot of gray and that can turn into a thousand questions. So, my stance (especially on these public forums) is to follow Unity's SLA.
     
    devstudents likes this.
  23. Duffer123

    Duffer123

    Joined:
    May 24, 2015
    Posts:
    1,032
    @Tryz,

    Does this asset play well with and is it suitable for opsive's third person controller ?
     
  24. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,222
    It should be fine. This asset doesn't have anything to do with character movement.
     
  25. Duffer123

    Duffer123

    Joined:
    May 24, 2015
    Posts:
    1,032
    Thx Tryz.
     
    Tryz likes this.
  26. AxelOz

    AxelOz

    Joined:
    Dec 8, 2016
    Posts:
    11
    hello guys, Im confuse all works very good but , my question for example if in my project have 2 sets of helmets that I remove and re-add to the main character, with the mounting point I just can set 1 mounting point to the helmet and the other to the Head bone in the main character and I need make socket to take off and take back? or how I can do this Im new to Unity and I really dont know how I can do it. the normal that I was doing this, taking off and taking back with 1 socket in the head bone and 1 socket in the Helmet, but my problem Using this way is that not all helmets are set up correctly, thats way I found the Mounting points but now Im stuck, I dont know how I can solve this. Please help me
     
  27. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,222
    Hi @AxelOz ,

    If you open up the MP_Demo scene (Assets\ootii\MountPoints\Demos\Scenes), I actually have an example with a helmet. So, I'll reference that.

    On the helmet, you add a single Mount:


    If you have multiple helmets, they each have a Mount. You'll see that the orientation will matter as it matches the head's mount point.

    Then, on the character's head bone, you add a mount point. Typically, I do this with a Mount List since the character probably has multiple mount points and the helmet has one.



    See how the orientation (colored lines) match the helmet's?

    Now, to connect these at run-time through code, you'd do something like the following:

    Code (CSharp):
    1. MountPoints lMountPoints = GameObject.Find("DefaultMale").GetComponent<MountPoints>();
    2. GameObject lHelmet = lMountPoints.ConnectMountPoints("Head", "Prefabs/Armor/Helmets/Helmet", "Head");
    The first line you're finding your character and grabbing the Mount Points object (that's the Mount List) in the image above.

    The second line you're saying to connect the character's "Head" mount point with the helmet prefab and the helmet's "Head" mount point.

    The path you see is to a Resources folder. That's a special unity folder were you can put assets that aren't in your scene. So, you could have the following helmets:
    Prefabs/Armor/Helmets/Helmet
    Prefabs/Armor/Helmets/Helmet2
    Prefabs/Armor/Helmets/Helmet3
    etc.

    That second line will actually create the helmet and connect them together.

    To remove the helmet, you'd do this:
    Code (CSharp):
    1. MountPoint lHelmetMP = lHelmet.GetComponent<Mount>().Point;
    2. mMountPoints.DisconnectMountPoints(lHelmetMP);
    3. GameObject.Destroy(lHelmet);
    I hope that helps.
     
  28. AxelOz

    AxelOz

    Joined:
    Dec 8, 2016
    Posts:
    11
    Thank you for your explanation but I don't know in what script I have to add this 1 code:
    Now, to connect these at run-time through code, you'd do something like the following:
    1. MountPoints lMountPoints = GameObject.Find("DefaultMale").GetComponent<MountPoints>();
    2. GameObject lHelmet = lMountPoints.ConnectMountPoints("Head", "Prefabs/Armor/Helmets/Helmet", "Head");

    and To remove the helmet, you'd do this:
    1. MountPoint lHelmetMP = lHelmet.GetComponent<Mount>().Point;
    2. mMountPoints.DisconnectMountPoints(lHelmetMP);
    3. GameObject.Destroy(lHelmet);


      let me explain little more, lets use this example ,If I kill 2 monsters and loot 2 helmets 1 is good for kill fire monsters and the 2 helmet is good for kill Ice Monsters, where I need add this lines of code that you give me? for Add the helmet and for remove, and If I have this 2 helmets in my inventory just drag the helmet that I want to use to the slot for the helmets? Im sorry for ask maybe very noob questions. But I really don't know I hope you can explain me. Thank you and this assets is very nice I think is going save me lots of time.
     
  29. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,222
    Where and when you call those lines of code is really up to you and how you're building your game. If you have an inventory solution, it may be there... it just depends on how you're making the game.

    When building a game with assets, your job as the game developer is to figure out how to glue all the assets together. Unfortunately, I don't know the other assets you're using (and probably don't own them).

    You just have to take a step back and layout your architecture. Think about what assets you have, how you want them to work, and then fill in the missing pieces... the glue.
     
    Shawn67 likes this.
  30. ViveLeCommune

    ViveLeCommune

    Joined:
    May 2, 2015
    Posts:
    9
    I'm having an issue where creating skinned mesh objects from code works in the editor but not in the build, which seems strange to me.
     
  31. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,222
    Just to make sure everything is good, I created this demo as a PC build and everything ran as an exe:
    http://www.ootii.com/Unity/MountPoints/Demo_01/index.html

    Does that work for you?

    What do you mean "creating skinned mesh objects from code"?
     
  32. ViveLeCommune

    ViveLeCommune

    Joined:
    May 2, 2015
    Posts:
    9
    Yes, it does. I think the problem is with how I'm finding which object to spawn.

    I have inventory objects that have a spawn item parameter and when they're equipped I call this line of code:

    mounts.AddSkinnedItem("Resources/Clothing&Armor/" + d.spawnItem.name);
     
  33. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,222
    Cool.

    Take out the "Resources/" part. I'm looking at the MP editor for the demo and I don't include that in the "Resource Path" property. When I call to Unity's resources functions, I don't believe they need it.

    I'm wondering if the "&" will be an issue too. I'm not sure if Unity will like that or not.
     
    ViveLeCommune and hopeful like this.
  34. Zymes

    Zymes

    Joined:
    Feb 8, 2017
    Posts:
    106
    Does this work with uFPS? What I want is a system where I can carry objects in my player hands (first person). If it is a weapon I can use it, like an axe. If it is a buildable object I can just carry it and it is visible in left or right hand.

    A bit like Eco if you seen that game.
     
  35. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,222
    Yes.

    As long as there's a normal rig with transforms that represent the hands, you can create Mount Points and attach objects to them.

    In the documentation, I describe how you do that and provide some coding examples:
    http://www.ootii.com/Unity/MountPoints/MPUserGuide.pdf

    The demo will also be a great resource for examples on mounting/un-mounting through code.
     
  36. Zymes

    Zymes

    Joined:
    Feb 8, 2017
    Posts:
    106
    Another question for another use case.

    If I have for example a car. Can I make wheels that pop on to the wheel base, and remove them? Or if I have a plate and I want to put food on it. Can this work in the same way?
     
  37. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,222
    Yes.

    I don't do anything to force something like the car wheels to rotate, but you can use it to connect and disconnect objects. You'll just set the mount points up on the plate and the food.
     
  38. james14123

    james14123

    Joined:
    Jan 22, 2017
    Posts:
    20
    Hi
    Can this tool make a mesh object attach to another skinned mesh like the pants in example video? Or two skinned mesh object?
    Ex: A static cloth (mesh render) attach to body (skinned mesh render)
     
  39. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    4,877
    What this does is bring two MP objects together that you have already matched in the editor. So you assign one MP to your skinned mesh (or whatever) and you assign the other MP to your weapon or clothing item or whatever. Then you can join them, and they will automatically take the orientations relative to one another that you set in the editor.

    So it doesn't matter specifically if they are both skinned or not, but of course skinned meshes are able to bend according to how they are weighted to their shifting bones, and regular meshes do not.

    FWIW, I think you could probably join a MP on a helmet, for instance, to a MP on the hand, and then as the hand moves to the head, have the helmet drop the hand MP and instead match with a MP on the head, thus donning the helmet.
     
    Tryz and james14123 like this.
  40. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,222
    @hopeful is exactly right.

    The only other thing that I'd add is that you can associated a mount point with the bones (not vertices). So, if your skinned mesh is a human with a humanoid skeleton, you can create a mount point on his right hand, head, etc. The object you attach to that mount point (say a sword with a mount point at its handle) will then follow the hand when the two mount points connect.

    It won't do really do two skinned meshes. The child mesh would have to have its mount point at the root. For example, It won't allow two humanoids to hold hands.
     
  41. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    4,877
    Well, it wouldn't allow two separate humanoids to join hands - sort of - but if you needed to have one character pick up and throw another, it might work for that, right? ;)
     
    Tryz likes this.
  42. ravin5432

    ravin5432

    Joined:
    Aug 26, 2012
    Posts:
    5
    It seems that it didn't save the custom actions you created. You could try uploading the actions into Playmaker Ecosystem browser addon. Or make a zip file we can download with just the scripts. If that is easier to do then updating the entire package.
     

    Attached Files:

  43. ravin5432

    ravin5432

    Joined:
    Aug 26, 2012
    Posts:
    5
    Nevermind, I found the package for playmaker.
    MountPoints/Extra/playmaker
    My bad
     
    Tryz likes this.
  44. adamz

    adamz

    Joined:
    Jul 18, 2007
    Posts:
    910
    Looks great! How does the clothing masks work? Do I need to use your Material, or can I use my own Material and have that on top of my custom shader?
     
  45. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,222
    You don't need to use my material, but you do need a shader that supports transparencies/cutout.

    Check out page 17 of the User's Guide. That should explain how it works:
    http://www.ootii.com/Unity/MountPoints/MPUserGuide.pdf
     
    Shawn67 likes this.
  46. Aji1

    Aji1

    Joined:
    Jul 17, 2014
    Posts:
    18
    I want to delete clothes that I currently mount and change to new clothes

    Please tell me how to get the current skin item name
     
  47. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,222
    Deleting clothes is just a matter of deleting the GameObject that was created and references the clothes you put on.

    If you are creating the clothes through code like in my examples, I return the GameObject that is created, but I do not store it. It would be up to you to store the GameObject and destroy it when needed. I do it this way because I don't know what inventory solution you are using and don't want to keep references around accidentally. So you are in complete control after I return the GameObject.
     
  48. Aji1

    Aji1

    Joined:
    Jul 17, 2014
    Posts:
    18
    I am using Devdog Inventory pro

    I added clothes with code AddSkinItem when using items
     
  49. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,222
    AddSkinnedItem() will return a GameObject that is the skinned item that was created. You need to store that GameObject reference. When you no longer need it, you can call GameObject.Destroy(YourGameObject).

    It is up to you on where you store it and when you destroy it.

    Mount Points isn't an inventory solution like Inventory Pro. It simply creates and mounts items. You can manage the items anyway you want.

    I'm not familiar enough with Inventory Pro to know if it can store a GameObject and how. That would be a good question for DevDog.
     
  50. Aji1

    Aji1

    Joined:
    Jul 17, 2014
    Posts:
    18
    Thanks for the advice!
    The problem was solved.
     
    Tryz likes this.