matter-js icon indicating copy to clipboard operation
matter-js copied to clipboard

Restart Matter after page changes in nuxt.js

Open PhilippeUn opened this issue 3 years ago • 1 comments

Hi, I have a matterjs instance in my nuxt app that drops items on the floor. Everything works when I visit the page for the first time or do a page refresh. But when I change the pages (routes) inside my app, so I come back to the page with the matterjs instance, the drop effect is not restarted and all bodies are gone.

What do I have to worry about? Can anyone help me please?

I start the "Fallbox" on mounted()

PhilippeUn avatar Sep 01 '22 08:09 PhilippeUn

This isn't really in the scope of issues here as it doesn't sound like an issue with matter.js? My guess is you need to properly dispose / recreate your engine / runner / scene when your pages navigate?

If it is a single page app, it could be that the page that is running the engine is still held in memory and is simply being shown or hidden rather than actually disposed, but you'd need to look into that in your framework.

liabru avatar Sep 02 '22 09:09 liabru