Fizz X
Re: Fizz X
Thanks Ivan. It's working. I'm finding a few small kinks, but overall this library is enabling one of my first games to work. My biggest challenge now is to defeat tunneling by striking the right balance with the update steps.
Re: Fizz X
Hello and thanks for the feedback. One easy way to stop the tunneling is by using a constant time step:
Another option is to limit the "maxVelocity = 1000" constant to a smaller value.
If (maxVelocity*dt < smallestObjectSize) then you should never see tunneling at all.
Please include a love file if you need any support.
FizzX is a decent lib, the biggest downside is the partitioning system which is slow and complicated.
I'll try to improve the partitioning when I have a chance.
Other than that it's actually quite efficient, especially if most of your objects are static.
The basic internals of Fizz are explained here:
https://2dengine.com/?p=collisions
Thanks again!
Code: Select all
accum = 0
step = 1/60
function update(dt)
accum = accum + dt
while accum >= step do
fizz.update(step)
accum = accum - step
end
end
If (maxVelocity*dt < smallestObjectSize) then you should never see tunneling at all.
Please include a love file if you need any support.
FizzX is a decent lib, the biggest downside is the partitioning system which is slow and complicated.
I'll try to improve the partitioning when I have a chance.
Other than that it's actually quite efficient, especially if most of your objects are static.
The basic internals of Fizz are explained here:
https://2dengine.com/?p=collisions
Thanks again!
-
- Prole
- Posts: 21
- Joined: Thu Mar 06, 2014 3:00 pm
Re: Fizz X
Hello, ivan.
I have a question. How i can mark side of rectangle shape like it's collides with static shape?
I need this for correct collisions with my own level geometry (by pixels). By while one shape can push other shape through my geometry.
I have a question. How i can mark side of rectangle shape like it's collides with static shape?
I need this for correct collisions with my own level geometry (by pixels). By while one shape can push other shape through my geometry.
Re: Fizz X
Does Fizz X support Pac-Man-style wraparounds? I might need that in the near future; I'm currently assessing the plausibility of all my old, unfinished games.
Re: Fizz X
Hello Andrey,AndreyMust19 wrote: ↑Tue Feb 06, 2018 4:34 pm Hello, ivan.
I have a question. How i can mark side of rectangle shape like it's collides with static shape?
I need this for correct collisions with my own level geometry (by pixels). By while one shape can push other shape through my geometry.
I have commented out this part of the code since it's much better to use "line shapes" for this sort of thing.
https://github.com/2dengine/fizzx/
Then you can do thing like:
Code: Select all
rect = fizz.addDynamic("rect", 0, 0, 100, 100)
rect.bottom = true -- can no longer collide from the bottom
You really should consider using "line shapes" for this sort of thing.
Not supported out of the box, but it's easy to implement something like that using the "modulo" operator:Does Fizz X support Pac-Man-style wraparounds? I might need that in the near future; I'm currently assessing the plausibility of all my old, unfinished games
Code: Select all
function update(dt)
-- update your simulation
-- wrap around:
x,y = fizz.getPosition(pacman)
x = x%screenWidth -- clamps x from 0 to "screenWidth"
y = y%screenHeight -- clamps y from 0 to "screenHeight"
fizz.setPosition(pacman, x, y)
end
PS. Andrey, I may have misread your question, if you meant how do you figure out which side has collided then:
Code: Select all
function myshape:onCollide(other, nx, ny, pen)
if nx < 0 then
-- right
elseif nx > 0 then
-- left
elseif ny < 0 then
-- bottom
elseif ny > 0 then
-- top
end
end
Last edited by ivan on Wed Dec 15, 2021 11:31 am, edited 2 times in total.
-
- Prole
- Posts: 21
- Joined: Thu Mar 06, 2014 3:00 pm
Re: Fizz X
O, nice, i made this:
Code: Select all
if (me.phys.l > 0 and nx < 0) then shape_a.x = shape_a.x - nx; end
if (me.phys.r > 0 and nx > 0) then shape_a.x = shape_a.x - nx; end
if (me.phys.u > 0 and ny < 0) then shape_a.y = shape_a.y - ny; end
if (me.phys.d > 0 and ny > 0) then shape_a.y = shape_a.y - ny; end
Who is online
Users browsing this forum: Ahrefs [Bot] and 2 guests