Amazing. Thank you based kitito.kikito wrote:You raise a completely valid concern. I will see what I can do. Thanks
EDIT: Done. I've added two new methods to world:
I am releasing v3.1.2 with these changes
- local items, len = world:getItems() is just what you need
- local count = world:countItems() just returns the number of items
[library] bump.lua v3.1.4 - Collision Detection
Re: [library] bump.lua v3.1.2 - Collision Detection
- josefnpat
- Inner party member
- Posts: 955
- Joined: Wed Oct 05, 2011 1:36 am
- Location: your basement
- Contact:
Re: [library] bump.lua v3.1.2 - Collision Detection
I just wanted to leave a thank you; I integrated this into Judgement Arena, and it works flawlessly! Thanks so much for writing this library!
Missing Sentinel Software | Twitter
FORCIBLY IGNORED.
<leafo> when in doubt delete all of your code
<bartbes> git rm -r *
<bartbes> git commit -m "Fixed all bugs"
<bartbes> git push
FORCIBLY IGNORED.
<leafo> when in doubt delete all of your code
<bartbes> git rm -r *
<bartbes> git commit -m "Fixed all bugs"
<bartbes> git push
- kikito
- Inner party member
- Posts: 3153
- Joined: Sat Oct 03, 2009 5:22 pm
- Location: Madrid, Spain
- Contact:
Re: [library] bump.lua v3.1.2 - Collision Detection
I am glad it is working for you! Thanks for trying my lib
When I write def I mean function.
- josefnpat
- Inner party member
- Posts: 955
- Joined: Wed Oct 05, 2011 1:36 am
- Location: your basement
- Contact:
Re: [library] bump.lua v3.1.2 - Collision Detection
I'm using this library as a spatial partition, and it works brilliantly!
Missing Sentinel Software | Twitter
FORCIBLY IGNORED.
<leafo> when in doubt delete all of your code
<bartbes> git rm -r *
<bartbes> git commit -m "Fixed all bugs"
<bartbes> git push
FORCIBLY IGNORED.
<leafo> when in doubt delete all of your code
<bartbes> git rm -r *
<bartbes> git commit -m "Fixed all bugs"
<bartbes> git push
- kikito
- Inner party member
- Posts: 3153
- Joined: Sat Oct 03, 2009 5:22 pm
- Location: Madrid, Spain
- Contact:
Re: [library] bump.lua v3.1.2 - Collision Detection
Hey, that is cool!
Have you tried tweaking the cell size? Your game seems to be relatively sparse (compared to a tile-based game) so playing with the cell size should bring some interesting results. (Remember that you will have to re-create the world and re-insert the ships every time you change the cell size)
Have you tried tweaking the cell size? Your game seems to be relatively sparse (compared to a tile-based game) so playing with the cell size should bring some interesting results. (Remember that you will have to re-create the world and re-insert the ships every time you change the cell size)
When I write def I mean function.
- josefnpat
- Inner party member
- Posts: 955
- Joined: Wed Oct 05, 2011 1:36 am
- Location: your basement
- Contact:
Re: [library] bump.lua v3.1.2 - Collision Detection
Not too much! I'll have to try it out.kikito wrote:Hey, that is cool!Have you tried tweaking the cell size?
Missing Sentinel Software | Twitter
FORCIBLY IGNORED.
<leafo> when in doubt delete all of your code
<bartbes> git rm -r *
<bartbes> git commit -m "Fixed all bugs"
<bartbes> git push
FORCIBLY IGNORED.
<leafo> when in doubt delete all of your code
<bartbes> git rm -r *
<bartbes> git commit -m "Fixed all bugs"
<bartbes> git push
Re: [library] bump.lua v3.1.2 - Collision Detection
Hi guys,
First of all I would like to say that bump is an amazing library, collisions in my new project are entirely based on it and it works great! But I'm having a strange issue and I'm not sure where it comes from.
Here is what happens (but quite rarely to be honest):
=> I resolve a collision between my player and a wall, bump returns me a position and I update my player position to it (it should be against the wall).
=> Then I keep the same velocity and I try to solve a collision from my new position, but bump tells me there's no collision, and I update my player position.
=> I continue to test my collisions with the same velocity, and this time bump tells me that I have a collision and send me back to the initial position it sent me at step 1.
=> And so on, one test will tell me that I've no collisions and the next one it will send me back at my initial position, making my player to move a bit.
Visually, here's the result (the issue is visible on the left wall, the right one works without problem):
I tracked it down to a simple example (love file attached):
When running it, you'll see that on one frame you'll get a collision, then the next one no collisions, and so on. And moving a bit the wall solve it (bump always detects a collision).
Am I doing something wrong?
Thanks for your help!
First of all I would like to say that bump is an amazing library, collisions in my new project are entirely based on it and it works great! But I'm having a strange issue and I'm not sure where it comes from.
Here is what happens (but quite rarely to be honest):
=> I resolve a collision between my player and a wall, bump returns me a position and I update my player position to it (it should be against the wall).
=> Then I keep the same velocity and I try to solve a collision from my new position, but bump tells me there's no collision, and I update my player position.
=> I continue to test my collisions with the same velocity, and this time bump tells me that I have a collision and send me back to the initial position it sent me at step 1.
=> And so on, one test will tell me that I've no collisions and the next one it will send me back at my initial position, making my player to move a bit.
Visually, here's the result (the issue is visible on the left wall, the right one works without problem):
I tracked it down to a simple example (love file attached):
Code: Select all
local bump = require "bump"
--
local world
local player = { name = "Player", x = -638.37210358366, y = 121.258009477, width = 45, height = 230 }
local wall = { name = "Wall", x = -836.50049554579, y = 9.28935041878, width = 198.12839196213, height = 406.74931778108 }
--
-- LOVE callbacks
--
function love.load(arg)
world = bump.newWorld()
world:add(player, player.x, player.y, player.width, player.height)
world:add(wall, wall.x, wall.y, wall.width, wall.height)
end
function love.draw()
love.graphics.translate(1200, 0)
love.graphics.scale(1.2, 1.2)
love.graphics.setColor({ 0, 255, 0, 150 })
love.graphics.rectangle("fill", player.x, player.y, player.width, player.height)
love.graphics.setColor({ 255, 0, 0, 150 })
love.graphics.rectangle("fill", wall.x, wall.y, wall.width, wall.height)
end
function love.update(dt)
local actualX, actualY, cols, len = world:move(player, player.x - 0.05, player.y)
player.x = actualX
player.y = actualY
print("actualX="..actualX..", actualY="..actualY)
print(len)
end
Am I doing something wrong?
Thanks for your help!
- Attachments
-
- bump_test.love
- (6.86 KiB) Downloaded 117 times
- kikito
- Inner party member
- Posts: 3153
- Joined: Sat Oct 03, 2009 5:22 pm
- Location: Madrid, Spain
- Contact:
Re: [library] bump.lua v3.1.2 - Collision Detection
Hi there,
I am envious of your art style - it looks very nice!
Thanks for taking the time to prepare a test example. I will investigate this as soon as I can, but please understand that these "right in the border with smaller-than-1-pixel-movement" situations might take some time to resolve. It is usually some < that should be a <=, or floating-point comparison.
I am envious of your art style - it looks very nice!
Thanks for taking the time to prepare a test example. I will investigate this as soon as I can, but please understand that these "right in the border with smaller-than-1-pixel-movement" situations might take some time to resolve. It is usually some < that should be a <=, or floating-point comparison.
When I write def I mean function.
Re: [library] bump.lua v3.1.2 - Collision Detection
Thanks, I'm lucky to work with a very talented artist for this project!I am envious of your art style - it looks very nice!
And yes I'm testing with really small values as I'm using an interpolated accelerated speed for the player (thanks to Tween btw ), and for acceleration I'm using an inQuad interpolation, so it starts very small.
EDIT: And I just made further testings, if you change the offset from 0.05 to 10 in my example the problem is still here, and a lot more visible this time.
- Jasoco
- Inner party member
- Posts: 3726
- Joined: Mon Jun 22, 2009 9:35 am
- Location: Pennsylvania, USA
- Contact:
Re: [library] bump.lua v3.1.2 - Collision Detection
Is it at all possible to somehow integrate circular collision detection (Not necessarily resolution, just detection) into Bump? I don't need to resolve collisions with them or anything (Though I would love to be able to have arbitrary shapes if someone made a simple library like Bump that resolved collisions with them.) but just detect Bump box objects overlapping with circular, and possibly oval shapes. Just for detection.
Expanding on that, maybe detect collisions (But not resolve) with other polygonal shapes.
While Bump's 90º square boxes are great for making the environment, I'd like more options for shapes when it comes to adding in hitboxes for enemies and other things. Like if I wanted to add a circular saw like so many other games have now (They're like crates in 3D games.) with just Bump I'd have to use a bunch of small boxes to create a rudimentary circle or something then move all of them at the same time with the entity when all I really need is to detect if the box is overlapping it.
I mean I guess I could pile HardonCollider on top of Bump and use HC for hitboxes and Bump for platforming. If I had to. I would understand why you wouldn't want to put it in Bump for that very reason.
Thoughts?
Expanding on that, maybe detect collisions (But not resolve) with other polygonal shapes.
While Bump's 90º square boxes are great for making the environment, I'd like more options for shapes when it comes to adding in hitboxes for enemies and other things. Like if I wanted to add a circular saw like so many other games have now (They're like crates in 3D games.) with just Bump I'd have to use a bunch of small boxes to create a rudimentary circle or something then move all of them at the same time with the entity when all I really need is to detect if the box is overlapping it.
I mean I guess I could pile HardonCollider on top of Bump and use HC for hitboxes and Bump for platforming. If I had to. I would understand why you wouldn't want to put it in Bump for that very reason.
Thoughts?
Who is online
Users browsing this forum: No registered users and 0 guests