Physics Issues

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
tentus
Inner party member
Posts: 1060
Joined: Sun Oct 31, 2010 7:56 pm
Location: Appalachia
Contact:

Re: Physics Issues

Post by tentus »

Refpeuk wrote:I would still love to know why my fps is capped without me writing any code to do so, but it isn't for others.

Also, should I write dt into all the physics stuff, or does that happen automatically with world:update(dt)?

Thanks again
It depends on your video card. Some automatically cap at 60, others don't. A lot of onboard video chips do not cap themselves.

You should write dt into practically everything that updates. Physics, animations, AI, you name it. It's not that hard once you get used to it, you just have to get your head wrapped around the idea "if this doesn't happen in one frame, I need to use dt."
Kurosuke needs beta testers
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: Physics Issues

Post by bartbes »

Refpeuk wrote:world:update(dt)?
Yes, it does, thankfully, most libs (both inbuilt and found on the forums) already care about dt, and if you have an update function that wants dt, you can probably assume it does.
User avatar
Refpeuk
Citizen
Posts: 91
Joined: Wed Dec 14, 2011 6:16 pm

Re: Physics Issues

Post by Refpeuk »

OK, I've written dt into everything that I think would be affected. (animations and physics already had it)

I also added a roll with shift. The animation isn't speed-sensitive yet, and cancels as soon as you let go of shift. The biggest issue however is that when rolling under a block the player still inexplicably slows down. I was wondering if anyone could tell me why this is?

The way I have it working is now the player has two collision shapes, upper and lower, and whenever he is rolling (same for crouching, sliding, etc) the top one is set as a sensor so that it doesn't collide with anything (I assume this is the most efficient way to do it), and when <shift> is released it's set back to normal.
Attachments
platformer.love
(46.07 KiB) Downloaded 54 times
It was the best of times, it was the worst of times . . .
User avatar
The Burrito
Party member
Posts: 153
Joined: Mon Sep 21, 2009 12:14 am
Contact:

Re: Physics Issues

Post by The Burrito »

Refpeuk wrote:The biggest issue however is that when rolling under a block the player still inexplicably slows down. I was wondering if anyone could tell me why this is?
It's your player.sensor stuff, the left and right checks are zeroing the x velocity when they "hit" the block, you could split it up into an upper and lower collision, and mask the uppers when rolling.
User avatar
Refpeuk
Citizen
Posts: 91
Joined: Wed Dec 14, 2011 6:16 pm

Re: Physics Issues

Post by Refpeuk »

Oh thanks, good catch!
It was the best of times, it was the worst of times . . .
Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 15 guests