Keeping bodies from going through other bodies

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.
User avatar
Tesselode
Party member
Posts: 555
Joined: Fri Jul 23, 2010 7:55 pm

Keeping bodies from going through other bodies

Post by Tesselode »

So I've got a platform rotating based on the change in mouse position. And a ball. Yes it's Tilt. And if I rotate the platform fast enough, the ball will go right through the platform. Even if I'm using CCD. Or if I increase the thickness of the platform. Anything I can do besides limiting the speed of the platform?
User avatar
Jasoco
Inner party member
Posts: 3725
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

Re: Keeping bodies from going through other bodies

Post by Jasoco »

A) Are you rotating the platform by setting its angle manually? Or by setting its impulse or whatever? Because if it's the former, there's your problem.

B) Have you tried setting the ball as a bullet?
User avatar
Tesselode
Party member
Posts: 555
Joined: Fri Jul 23, 2010 7:55 pm

Re: Keeping bodies from going through other bodies

Post by Tesselode »

Jasoco wrote:A) Are you rotating the platform by setting its angle manually? Or by setting its impulse or whatever? Because if it's the former, there's your problem.

B) Have you tried setting the ball as a bullet?
A. I'm using setAngularVelocity.

B. Yes. Didn't help.
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: Keeping bodies from going through other bodies

Post by bartbes »

Have you tried updating the physics world with fixed (small) timesteps?
User avatar
Tesselode
Party member
Posts: 555
Joined: Fri Jul 23, 2010 7:55 pm

Re: Keeping bodies from going through other bodies

Post by Tesselode »

bartbes wrote:Have you tried updating the physics world with fixed (small) timesteps?
Wouldn't that make the physics run at different speeds on different computers?
User avatar
Chief
Party member
Posts: 101
Joined: Fri Mar 12, 2010 7:57 am
Location: Norway, 67° north

Re: Keeping bodies from going through other bodies

Post by Chief »

Tesselode wrote: Wouldn't that make the physics run at different speeds on different computers?
No, just divide the delta time, or make a timer where you put delta time to 0 and when the timer is over it goes back to the original delta time.
User avatar
Tesselode
Party member
Posts: 555
Joined: Fri Jul 23, 2010 7:55 pm

Re: Keeping bodies from going through other bodies

Post by Tesselode »

That didn't work. Any other ideas?
User avatar
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

Re: Keeping bodies from going through other bodies

Post by kikito »

I'd say you've reached the point where you must upload what you've got.
When I write def I mean function.
User avatar
Tesselode
Party member
Posts: 555
Joined: Fri Jul 23, 2010 7:55 pm

Re: Keeping bodies from going through other bodies

Post by Tesselode »

Well, I think I've pretty much worked around it now, but when I release Tilt r9, you can take out the code for limiting the platform rotation speed and see what I mean.
pekka
Party member
Posts: 206
Joined: Thu Jan 07, 2010 6:48 am
Location: Oulu, Finland
Contact:

Re: Keeping bodies from going through other bodies

Post by pekka »

The Box2D manual isn't explicit about the issue, but it contains this highly suggestive sentence:
Box2D performs continuous collision sequentially, so bullets may miss fast moving bodies.
I take this to mean that it is possible for the fast moving non-bullet platform to skip over the small bullet body, since Box2D doesn't use CCD when it processes the platform's movement. I don't know what goes on for certain, since this hasn't come up for me. And I am not intimately familiar with Box2D source code...

Did you try setting your platform to be a "bullet" too? If not, it is worth a try.

Reference: http://www.box2d.org/manual.html
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 231 guests