#Avian Physics

46066 messages · Page 47 of 47 (latest)

nimble fiber
#

Mind sharing a video of what's going on?

deft marsh
#

i think the issue might be somewhere else, can i somehow make colliders visible?

nimble fiber
#

Yeah, PhysicsDebugPlugin

deft marsh
#

ok so my colliders aren't working properly

#

as you can see, this is detecting a collision with this object, even though the collider is not even going in a direction where it'd collide

nimble fiber
#

Do you know which entity it's colliding with?

#

Might give you a hint as to what's going on

#

Some thoughts just by looking:

  • If the scale of your colliders is very small but the margins are large, they might be hitting the wall on either side of the player?
  • Does the bullet entity have some kind of timeout?
  • Is it possible they're colliding with the player and despawning on a delay

Hard to diagnose just by looking looking though...

deft marsh
#

It is colliding with the chunk I'm on (the terminal behind is the one i'm using to debug this)

#

it might be the margins tho

#

the bullet entity has no timeouts

nimble fiber
#

My guess is margins but it'd be a weird one

deft marsh
#

what's the default collision margin?

#

oh, none?

nimble fiber
#

yeah which is why it'd be weird if it was margins :/

#

this one doesn't make a lot of sense to me, it almost looks like it's hitting the border of the collider as though it was still there even after despawning? But that wouldn't make sense because simple shapes do have solidity, it's only collision meshes which don't

deft marsh
#

importantly, i can move through the borders the ball can't cross, and it's only from certain angles that this happens

#

it almost feels like maybe the way avian determines collisions with rectangle shapes is wrong?

#

or with circle shapes

#

ok it's definitely specifically collisions detected by Collisions

#

the object does not bounce like this

#

(i removed the self destruction thingy and it collides with things that it doesn't bounce on)

#

(it has a low restitution)

#

(high? one of the two)

#

(whichever is bouncy. can't recall)

deft marsh
nimble fiber
#

That's weird I was always under the impression that Collisions was pretty much the lowest-level you can get

deft marsh
#

same issue with collisionstarted messages

nimble fiber
#

Afraid this is outside my ability :/ I wonder if it is a bug but it's one I've never seen before

deft marsh
#

same issue with the CollidingEntities component

vestal minnow
#

you could also filter the collisions by penetration depth for the purposes of despawning, i.e. filter out contacts where find_deepest_contact returns a point where penetration < 0.0 (meaning the shapes are actually separated)

#

contacts are not always necessarily actually touching if you have speculative collision enabled

deft marsh
#

iiinteresting

#

woo! fixed!

#

what's the default speculative margin?

nimble fiber
#

i'll just tuck that away for later and for next time this comes up...

deft marsh
#

i'll perform some more tests to make sure it wasn't a fluke

vestal minnow
# deft marsh what's the default speculative margin?

Well the upper bound for it is currently infinite, but it's always clamped based on the velocity of the body, so it's essentially the distance that the body would move during the next timestep, given the current velocity

#

the idea with speculative collision is that it lets the solver "predict" contacts before they happen rather than allowing bodies to clip into/through walls and such, but it can cause these sorts of ghost collisions at high speeds

#

setting SpeculativeMargin lets you specify an upper bound for that margin or even disable speculative collision entirely by setting it to zero

#

the Bepu physics engine has the same, and also defaults to it being infinite IIRC

#

however I'd like to try Box2D's approach to continuous collision at some point, I believe it's a bit smarter about this and not quite as prone to ghost collisions

prisma bay
#

@vestal minnow u free rn for quick question?

#

I was planning to have 2 different physics tick rate in my world

#

as a part of this idea:

  • anything related to network and players run at 64hz
  • anything that's related to rest of the world - 20hz.

physics for players run at 64hz, and for everything else - 20hz.
thinking of using client side prediction with entity interpolation logic to smoothen stuff out and make it compatible with higher refresh rates

#

but avian only supports single tick rate for a world

#

thinking of having custom cheap logic for non players, so NPCs/zombies etc run through cheap simulations

autumn lake
#

I am making a simple brick-breaker style game, and it seems the ball is gaining energy over time. I have all the colliders set up with

     Restitution::PERFECTLY_ELASTIC,
     Friction::ZERO,

but there is a consistent energy gain. After a few dozen collisions, the ball moves so fast it can't be seen and basically clears the remaining blocks instantly from how fast it is moving

I suspect this is caused by one of two things:
a) brick colliders "touching". The bricks have no space between them and the rectangular colliders match. Possibly the ball is "hitting" two bricks at once in an edge case and momentum is not computed properly
b) The brick colliders are removed when a collision is detected. Maybe I need to defer the removal until the collision is no longer happening?

Does anyone have ideas/thoughts on this?

sweet sundial
#

try it with just one brick that doesn't vanish?

nimble fiber
#

so, this isn't really a solution to the problem, but making the ball either a kinetic body might not be a bad idea. This is the kind of situation where you end up fighting the dynamic rigidbody behavior.

sweet sundial
#

honestly if you're in 2d making breakout and a dynamic body doesn't work it might just be easier to model it with aabbs and nothing else

lavish orbit
#

is there any fork or branch of avian out there that works with bevy 0.19.0-rc.2?

lavish orbit
#

yeah I found that one, but that is bevy main, not the rc which some of my other deps do already use. I'm in the process of doing the work myself, and will probably just put it up as a draft PR soon so others can use it too!

vale dragon
#

oh, thanks! just pointing to that because I just saw it, some folks don't know about #physics-dev

acoustic spoke
#

what's the current status of 0.19 port in avian? is there a functional branch i could use?

acoustic spoke
lavish orbit
acoustic spoke
#

thanks! i'll get back to you soon, i'm not on my linux right now

lavish orbit
#

yeah no rush, I'm about to try it in my own project as well

fallow pike
#

what the best substep count?

#

btw, joint overpower in cars kinda fixed now?

fallow pike