dimforge / rapier

2D and 3D physics engines focused on performance.
https://rapier.rs
Apache License 2.0
3.77k stars 235 forks source link

How do you simulate refraction? #608

Closed nowakf closed 1 month ago

nowakf commented 3 months ago

Say you want to simulate a lens, so you shoot a ball into a region, you don't want to reflect it off the surface, but rather, refract it.

I tried to do this using PhysicsHooks::modify_solver_contacts, but I couldn't work it out.

The other approach would be to have the lens work as a sensor, then just manually set the velocities of colliders entering it.

Is there a correct way here?

wlinna commented 3 months ago

I know nothing about refraction, but maybe someone at Dimforge Discord channel will? https://discord.gg/vt9DJSW

Issue trackers in general are only used to discuss bugs and feature requests

nowakf commented 3 months ago

Oh, ok. Is there any non-discord place to ask the question? Discord doesn't work on my machine.

EDIT: No luck! Don't worry then, sorry for spamming your tracker: I'll work it out.

wlinna commented 3 months ago

There is Stack Overflow. I don't know how popular it is compared to the Discord channel though. https://stackoverflow.com/questions/tagged/rapier

Is there any non-discord place to ask the question? Discord doesn't work on my machine.

Interesting. I'm on Linux and it works fine on both Firefox and Chromium. Oh well.

nowakf commented 3 months ago

My best guess is I live nextdoor to a very prolific spammer: I get mercilessly autobanned by automatically moderated platforms, even if I've previously been through the appeal process repeatedly :). It's generally no biggie.

Vrixyz commented 1 month ago

A sensor should work for that use case, yes, do you any particular reason for why it wouldn't be ?