Search Unity

  1. Unity 2019.1 beta is now available.
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. We're looking for insight from anyone who has experience with game testing to help us better Unity. Take our survey here. If chosen to participate you'll be entered into a sweepstake to win an Amazon gift card.
    Dismiss Notice
  4. Want to provide direct feedback to the Unity team? Join the Unity Advisory Panel.
    Dismiss Notice
  5. Unity 2018.3 is now released.
    Dismiss Notice
  6. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice

Custom Humanoid Avatar representation in Editor

Discussion in 'Extensions & OnGUI' started by Subliminum, Jan 26, 2019.

  1. Subliminum

    Subliminum

    Joined:
    Nov 9, 2017
    Posts:
    43
    Hello,

    I was wondering if it is possible to have a custom avatar style humanoid representation in the editor for displaying information about a ragdoll? I couldn't find anything online other then the normal tutorials for Avatar masking etc. I thought this could be a nifty way to get a graphic of the ragdoll's various limb states. Any help would be greatly appreciated! :)

    Subliminum.
     
  2. BinaryCats

    BinaryCats

    Joined:
    Feb 8, 2016
    Posts:
    152
    Hi,

    I have actually attempted this myself (https://forum.unity.com/threads/making-custom-avatarmask-style-editor.514769/)

    You can find how unity made the avatar editor here: https://github.com/Unity-Technologi.../Editor/Mono/Inspector/AvatarMaskInspector.cs


    From what I remember the editor works like this:
    There are two images, one image is what you see(okay its actually multiple images of all the body parts) and the other image is used as a sort of bounding box, lets call this image
    ImageB
    . ImageB has different coloured areas which relate to each bodypart. these areas would overlay the corresponding bodypart if the images where drawn on top of one another.

    When the user clicks on the editor, it gets the location of that click (in pixels), then it gets the pixel in that location from
    ImageB
    .

    It then gets the colour of that pixel.

    From the colour it knows which bodypart was selected. the head might be yellow, and a leg might be green.

    With that information it turns the bodypart on/off


    I hope that helps
     
    Subliminum likes this.
  3. Subliminum

    Subliminum

    Joined:
    Nov 9, 2017
    Posts:
    43
    Wow thanks! This will come in handy, i've always wondered how they'd built that UI.