Page 1 of 1

partially solid object

Posted: Wed Oct 02, 2019 8:58 pm
by JJSax
Hi everyone. I'm trying to find a way to create a physics object that doesn't interact solidly with other objects. Something where the two objects wont immediately bounce off each other, and be able to pass through but interacts a little.

This is a bit difficult to explain; sorry if it doesn't make sense. I'm trying to have a hoop interact a little with basketballs. I was thinking a rectangle object on a joint but I worry that they will occasionally go above the hoop and interact in wierd ways.

Re: partially solid object

Posted: Wed Oct 02, 2019 9:24 pm
by raidho36
A hoop is completely solid, it's just it's a three-dimensional object with a hole in the middle, that's why balls can pass through it. I'm stating the obvious but you need a firm grasp of this. In 2d you can simply use a slice of this hoop - two rigidly connected circles - and draw a fake solid graphics of the hoop on top.

To answer your question properly, you create objects that don't respond to collisions automatically, instead you create a manual collision response function that takes the collision normals and depths and applies the displacement (to move objects out of each other) only partially, or whatever other method of collision interaction is suitable.

Re: partially solid object

Posted: Wed Oct 02, 2019 10:05 pm
by JJSax
raidho36 wrote: Wed Oct 02, 2019 9:24 pm A hoop is completely solid, it's just it's a three-dimensional object with a hole in the middle, that's why balls can pass through it. I'm stating the obvious but you need a firm grasp of this.
I mean I'm completely aware of that. But it has a special movement and interaction that is very different than the rim itself.

So it sounds like I would have to create a custom function for that and there isn't some sort of built in function to make it less interactive with other objects without filtering it entirely?

Re: partially solid object

Posted: Wed Oct 02, 2019 11:15 pm
by raidho36
Yeah pretty much. Box2d is for simulating rigid objects, and being rigid implies being completely solid, but you can do something different with custom collision response functions. If your application is actually just a hoop physics in 2d then you should use a pair of solid circles at the edge of the hoop rim. There's also a sort of "layer" system but it's for switching collision detection between objects on and off entirely.

Re: partially solid object

Posted: Thu Oct 03, 2019 4:08 am
by JJSax
raidho36 wrote: Wed Oct 02, 2019 11:15 pm If your application is actually just a hoop physics in 2d then you should use a pair of solid circles at the edge of the hoop rim.
Yeah, that part is already done. The net physics would just make it feel a lot more real. Is the function to filter what can collide fixture:setFilterData()? https://love2d.org/wiki/Fixture:setFilterData

Re: partially solid object

Posted: Thu Oct 03, 2019 11:16 am
by raidho36
For net you should also use it's 2d slice equivalent. That is, a bunch of solid blocks connected in a flexible chain, and also distance-constrained with their opposite pair.

Re: partially solid object

Posted: Mon Oct 21, 2019 5:04 am
by JJSax
raidho36 wrote: Thu Oct 03, 2019 11:16 am For net you should also use it's 2d slice equivalent. That is, a bunch of solid blocks connected in a flexible chain, and also distance-constrained with their opposite pair.
That's a fair idea. I think that would work the best.