Search Unity

  1. Unity 2019.1 is now released.
    Dismiss Notice
  2. We've opened up a space to discuss, share feedback, and showcase everything related to the Unity Shader Graph! Come show us what you've made.
    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:
    65
    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:
    161
    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:
    65
    Wow thanks! This will come in handy, i've always wondered how they'd built that UI.