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

Re: Keeping bodies from going through other bodies

Post by Tesselode » Thu Aug 19, 2010 5:04 pm

pekka wrote: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.

Yes, I have tried settings the platforms and the ball to be bullets at the same time.

User avatar
Posts: 40
Joined: Wed Aug 04, 2010 2:49 am
Location: Henderson, Nevada, US

Re: Keeping bodies from going through other bodies

Post by Xkeeper » Thu Aug 19, 2010 8:59 pm

I'm not sure. It's kind of weird, because my little hack of your game doesn't display the behavior -- rotating the platforms fast enough will still make balls fly off in the right direction. :huh:

Code: Select all

			if platform_active[a]==1 and love.mouse.isDown("l") then --rotate platforms
			--limit platform rotation speed
			local rotspeedlimit=platform_size[a]/300
			if rotspeedlimit<1 then rotspeedlimit=1 end
			if platform[a]:getAngularVelocity()>math.rad(300/rotspeedlimit) then platform[a]:setAngularVelocity(math.rad(300/rotspeedlimit)) end
			if platform[a]:getAngularVelocity()<math.rad(-300/rotspeedlimit) then platform[a]:setAngularVelocity(math.rad(-300/rotspeedlimit)) end
Just as a note, though, it would be wise to do the speed check before ever setting the motion, cap it, then update it once and be done with it.

Post Reply

Who is online

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