Obtaining body by point.
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Obtaining body by point.
How can i obtain a body by a point? if there is a body of 100x100 in 250,300 how can i obtain it with the point 280,310 (for example)?
Re: Obtaining body by point.
You mean the coordinates or what exactly?Fab1can wrote:How can i obtain a body by a point? if there is a body of 100x100 in 250,300 how can i obtain it with the point 280,310 (for example)?
Twitter: https://twitter.com/Murii5
Re: Obtaining body by point.
I'm not sure if this is what you mean, but this is a way to identify when an object is inside a designated region.
Controls:
WASD - Green Block
D-Pad - Red Block
Controls:
WASD - Green Block
D-Pad - Red Block
- Attachments
-
- region.love
- (1.36 KiB) Downloaded 94 times
Re: Obtaining body by point.
By "body" do yo mean a physics body?
Re: Obtaining body by point.
First you do a query and this will give you a list of fixtures.
https://love2d.org/wiki/World:queryBoundingBox
Then you iterate the list and use "testPoint" on each fixture.
https://love2d.org/wiki/Fixture:testPoint
Last you get the associated body for each fixture.
https://love2d.org/wiki/Fixture:getBody
https://love2d.org/wiki/World:queryBoundingBox
Then you iterate the list and use "testPoint" on each fixture.
https://love2d.org/wiki/Fixture:testPoint
Last you get the associated body for each fixture.
https://love2d.org/wiki/Fixture:getBody
Re: Obtaining body by point.
Maybe this is what i want to do, but queryBoundingBox doesn't give me a list of fixtures.ivan wrote:First you do a query and this will give you a list of fixtures.
https://love2d.org/wiki/World:queryBoundingBox
Then you iterate the list and use "testPoint" on each fixture.
https://love2d.org/wiki/Fixture:testPoint
Last you get the associated body for each fixture.
https://love2d.org/wiki/Fixture:getBody
EDIT:
I need something like a OnClick function for a body (love.physics.body).
Who is online
Users browsing this forum: Ahrefs [Bot], Amazon [Bot] and 2 guests