How to check intersection between rectangle and TextureRegion LibGDX?

I don't know if it's possible, but I want to check it like this because I'm using some animated elements and some non animated elements. I was wondering how I would go about doing this. Thanks.

Upvotes: 0

Views: 162

Answers (2)

I ended up using another rectangle as a hit box that I set to the same moving coordinates as my TextureRegion.

Upvotes: 0

Julien
Julien

Reputation: 1067

If you are using Box2D you would create 2 bodies and trigger an event when there is a contact between the two. One would be a Dynamic body and the other one would be a StaticBody.

more information here> https://github.com/libgdx/libgdx/wiki/Box2d

Upvotes: 1

Related Questions