Page 5 of 5
Re: Physics Issues
Posted: Wed Jan 25, 2012 9:54 pm
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."
Re: Physics Issues
Posted: Wed Jan 25, 2012 11:03 pm
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.
Re: Physics Issues
Posted: Fri Jan 27, 2012 9:22 pm
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.
Re: Physics Issues
Posted: Sat Jan 28, 2012 5:55 am
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.
Re: Physics Issues
Posted: Tue Jan 31, 2012 12:06 am
by Refpeuk
Oh thanks, good catch!