Forum rules - please read before posting.

improvement idea: follow sorting map affects collider2d radius

I have a couple of characters which I keep from overlapping with circle colliders (this is very in important in my case because i use sprite unity complex so each body part is a sprite with a different z-position). characters on the same sorting layer could mix body parts when getting to near to each other. 

so the colliders do a good job.
now I got a very deep level, where the characters are scaled down a lot and the camera zooms in.
the circle colliders radius isn't affected by the follow sorting map so in the back the characters have huge collider circles compared to the body size and one npc doesn't have enough space so he is pushing my player character around.

It also limits the clickable area around the character, because the circle is so big.

the idea would be to extend the follow sorting map script that not only the size of the characters and the sorting layer would change according to the position, but also the circle colliders radius in relation to the characters size.

in sprite unity complex the follow sorting map script is on the sprite child (animator)
so GetComponentInParent<CircleCollider2d> could be used


Comments

  • I'm not following - when the character's size changes, so does the size of the collider (not the radius, but the transform).  I don't know why you'd want the radius to change as well.

    The FollowSortingMap affects the scale of the root object that contains the Player / NPC component.  So long as you place your FSM component on the assigned sprite child, you should find the whole character scales - try it with the 2D Demo player, Brain2D.
  • Thank you for the hints.
    I created the player character a year ago and had the collider on the root and the follow sorting map on the sprite animator child. The other NPCs are ok.Then I have other green circle gizmos that confused me .  I also removed all rigid bodies I added for no reason a year ago where i didn't know what that was :) so no characters are being pushed around anymore
  • ah no. I remember i ve been here some time.
    removing rigid body. player doesn't get pushed around by npcs. but no triggers.
    but i need triggers.
    so the root needs a rigidbody and a small circle collider for the triggers.
    follow sorting map on the root makes my player disappear in my case.
    so follow sorting map on the animator child together with a second circle collider that is bigger to circumvent overlapping body parts. this second circle collider gets scalled by the follow sorting map. the root one doesn't. which is ok.

    I 'll prevent the player pushing by nav mesh holes and moving him to an other position with an action.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.