how to avoid collision missing in hardoncollider

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
User avatar
Alexar
Party member
Posts: 174
Joined: Thu Feb 05, 2015 1:57 am
Location: Chengdu,China

how to avoid collision missing in hardoncollider

Post by Alexar »

I used hardoncollider in my platfomer. issue appeared when the object moves fast and it will go through the walls. also when two shapes for example two rectangles collide with only one side as the attachment refers. hardoncollider will not test any collision.
so how can i fix this? please help me!
1.png
1.png (1.22 KiB) Viewed 2345 times
User avatar
vrld
Party member
Posts: 917
Joined: Sun Apr 04, 2010 9:14 pm
Location: Germany
Contact:

Re: how to avoid collision missing in hardoncollider

Post by vrld »

This works for me:

Code: Select all

local HC = require 'HC'

function love.load()
	r1 = HC.rectangle(200,100,300,150)
	r2 = HC.rectangle(275,200,150,100)
end

function love.draw()
	r1:draw()
	r2:draw()

	local collide, dx,dy = r1:collidesWith(r2)
	love.graphics.print(("collide? %s, d = (%f,%f)"):format(collide, dx,dy), 10,10)
end
Can you upload a .love that shows the error?
I have come here to chew bubblegum and kick ass... and I'm all out of bubblegum.

hump | HC | SUIT | moonshine
User avatar
Alexar
Party member
Posts: 174
Joined: Thu Feb 05, 2015 1:57 am
Location: Chengdu,China

Re: how to avoid collision missing in hardoncollider

Post by Alexar »

vrld wrote: Can you upload a .love that shows the error?
http://www.filedropper.com/main_14
here is the .love file. containing the game that I am working on. the logic of player is in file cls/player.lua. I used 3 rectangles as aabb. and rule for collision is foot blocks foot; foot-- head no gravity. body for attack test. use wasd to walk, double press for run. space for jump and f for fight. you will see that only walking, there is no problem, but when running, if the next frames appears the situation that I mentioned, there generate no collision... so how can I fix it? thanks!
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest