The physics engine can't do line or "edge" shapes, can it

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
User avatar
VideroBoy
Party member
Posts: 102
Joined: Wed Mar 31, 2010 6:12 pm
Location: Canada

The physics engine can't do line or "edge" shapes, can it

Post by VideroBoy »

Because that would be too bad. It would make something I'm trying to do easier. :|
User avatar
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

Re: The physics engine can't do line or "edge" shapes, can i

Post by kikito »

It can do rectangular shapes. I don't know the side minimal length, but it should not be very big.
When I write def I mean function.
User avatar
VideroBoy
Party member
Posts: 102
Joined: Wed Mar 31, 2010 6:12 pm
Location: Canada

Re: The physics engine can't do line or "edge" shapes, can i

Post by VideroBoy »

I did a quick test and the narrowest I could make a rectangle is 6 pixels (meter is set to 64 pixels). That might be a bit high in a world made of 64x64 tiles. These edge bodies are going to lie between tiles you see.
User avatar
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

Re: The physics engine can't do line or "edge" shapes, can i

Post by kikito »

If you really, really want to do those "edges", then you could just do everything else 6 times bigger and zoom out x6 times.

But I recommend you to reconsider.

What so you need those "edges" for? Maybe there's a cleaner way too do what you want.
When I write def I mean function.
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: The physics engine can't do line or "edge" shapes, can i

Post by bartbes »

And it uses surface, so a 6x6 square could also be a 1x36 'line'.
User avatar
zac352
Party member
Posts: 496
Joined: Sat Aug 28, 2010 8:13 pm
Location: In your head.
Contact:

Re: The physics engine can't do line or "edge" shapes, can i

Post by zac352 »

bartbes wrote:And it uses surface, so a 6x6 square could also be a 1x36 'line'.
So it has to have a minimum surface area? Weird.
If I was writing it, I would have just made sure you can't make negative shapes. :P
Well... Those can be used to make traps/black holes, so I'd leave it be.
Hello, I am not dead.
User avatar
VideroBoy
Party member
Posts: 102
Joined: Wed Mar 31, 2010 6:12 pm
Location: Canada

Re: The physics engine can't do line or "edge" shapes, can i

Post by VideroBoy »

kikito wrote:What so you need those "edges" for? Maybe there's a cleaner way too do what you want.
As I mentioned, this is for a tile based game. I want something that acts like a zero-width wall between tiles, such that you can't enter one tile when crossing over from the other tile. I'm leery of a 6-or-whatever pixel width rectangle that lies on the edge because it would jut out from the true edge. I want it so that when there's an edge wall between two tiles, one tile acts like a whole wall when you're on one side, while when you're on the other side it's the other tile that acts like a wall. Does that make sense?
bartbes wrote:And it uses surface, so a 6x6 square could also be a 1x36 'line'.
Huh?
User avatar
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

Re: The physics engine can't do line or "edge" shapes, can i

Post by kikito »

VideroBoy wrote:I want something that acts like a zero-width wall between tiles, such that you can't enter one tile when crossing over from the other tile. I'm leery of a 6-or-whatever pixel width rectangle that lies on the edge because it would jut out from the true edge. I want it so that when there's an edge wall between two tiles, one tile acts like a whole wall when you're on one side, while when you're on the other side it's the other tile that acts like a wall. Does that make sense?
How about using setMask for that?

You would have to be a bit proactive about correctly setting up your player's masks on any given time, though.
When I write def I mean function.
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: The physics engine can't do line or "edge" shapes, can i

Post by Robin »

Box2D isn't too big on tile-based games. In the long run, it might be simpler to do without it.
VideroBoy wrote:
bartbes wrote:And it uses surface, so a 6x6 square could also be a 1x36 'line'.
Huh?
bartbes means that if you stretch a polygon shape so it has the right area, but is thin enough not to be noticeably wider than 0.

Using setMask would probably be better, though, if you're going to stick to Box2D.
Help us help you: attach a .love.
Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 4 guests