Forum rules - please read before posting.

Is there a way to make polygoncollider2D fit in the same shape as the 2D image/sprite ?

I basically have multiple 2D character images with transparent backgrounds and I want the collider to be in the same shape as their body so that the Hotspot hover stuff works perfectly and only when you are hovering over any part of character's body.

Doing it manually with the edit is very time consuming to outline the character so I'm wondering if there's a functionality or a better method that helps with that? Even if its by code, I just want to make sure that the hotspot only works when I hit the character's body.

Should I be combining hotspot with Raycaster? If so then can you give me an example of that. Thanks!

Comments

  • Just to be clear, Sprite Renderer works with polygoncollider but when it comes to UI image then you have to manually adjust the collider, so just wondering if AC has an easier way to handle something like that when it comes to Hotspot.

  • If you check "Generate Physics Shape" in a sprite asset's Inspector, attaching a PolygonCollider2D component to it in the scene should form an accurate shape around it.

    Are these images being animated, so that the collider needs to be animated / change shape?

    You mention "UI image", but only in your second post - are these sprites for characters in the scene, or part of a UI menu? If you can share images to show the issue, that'll help clarify the situation.

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.