Hello,
I'm implementing basic mouse click overlap for (convex) polygons. I have the polygon, now I just need to understand how to use testPoint(). The docs don't do an adequate job of explaining how exactly to use testPoint - what do the t- parameters do? Could someone provide the most basic example of what each of the parameters is for and how to use them? There's no example in the docs, searching the forums and Stack Overflow yielded nada.
If you need an example, let's say that my polygon is:
p = love.physics.newPolygonShape(30, 30, 30, 60, 75, 75, 75, 30)
And it's smack in the middle of a 200 by 300 window.
My mouse point is at 40, 40 (which is an overlap).
Thanks so much!
What do the parameters of Shape:testPoint do?
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
- kristinamay
- Prole
- Posts: 3
- Joined: Sat Nov 12, 2022 6:15 pm
- Contact:
Re: What do the parameters of Shape:testPoint do?
Is your shape actually attached to a Body? If that's the case, just use Fixture:testPoint(x, y).
If you're actually using a Shape that's not in the world at all, then I would assume that tx, ty, and tr are just offsets for the shape from the origin. Or in other words: the position and rotation of the Body that you imagine it being attached to.
If you're actually using a Shape that's not in the world at all, then I would assume that tx, ty, and tr are just offsets for the shape from the origin. Or in other words: the position and rotation of the Body that you imagine it being attached to.
Who is online
Users browsing this forum: Google [Bot] and 8 guests