Objects don't seem to interact properly moving beyond 4 pixels a tick

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.
Post Reply
dyl4n130
Prole
Posts: 24
Joined: Sat Jul 29, 2017 6:48 am

Objects don't seem to interact properly moving beyond 4 pixels a tick

Post by dyl4n130 »

I am messing around with collision detection and I have seem to encountered a problem. If an object is moving any fast than around 4.2 pixels each tick. I was using something like:

Code: Select all

if love.keyboard.isDown("w") then
	playerY = playerY - speed
end
If speed was more than 4.2 the game wouldn't update fast enough and would phase through objects because the collision detection wouldn't register until the object was already into it. How do I fix it?
alloyed
Citizen
Posts: 80
Joined: Thu May 28, 2015 8:45 pm
Contact:

Re: Objects don't seem to interact properly moving beyond 4 pixels a tick

Post by alloyed »

approach 1: implement swept collisions, or steal a collision engine that does it for you
approach 2: just increase the tickrate until it stops being a problem :p
approach 1.5: instead of increasing the tickrate of the entire game, do "subticks" where you lerp between the old tick and the new one, so to move from x = 0 to x = 10, you'd have a frame in the middle where x = 5 and so on
Post Reply

Who is online

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