Closed brianorwhatever closed 2 years ago
Currently I don't think it is easily possible to add a physics eninge to the project. You can only overwrite SC.Canvas
.
In the future I myself would like to have one integrated and easily usable. For performance reasons I would suggest some library that uses webassembly like rapier.
On SC.Canvas
you could simply add physics={true}
and it should work with realistic default settings. That would be awesome.
I found the way you can access the scene and a lot of other objects. Though I don't really understand how this works.
import { setup } from '../../utils/context.js';
const { root } = setup(); // here we have scene inside
I've created svelte-cannon. It's a declarative approach to setting up a cannon-es physics simulation using Svelte components.
It's designed with svelte-cubed in mind as renderer, check out this REPL or the Examples see it in action.
Awesome, thank you @bfanger. I will take a look at svelte-cannon when I get a free moment. Closing this issue now, thanks for your work.
How would one extend this library to include a physics engine such as
cannon
?I found this https://sbcode.net/threejs/physics-cannonjs tutorial but it requires access to the
scene
so I'm not sure how to use it with the component approach.