Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Will there be support on Next.js in the future? #88

Closed
kayden1940 opened this issue Sep 15, 2022 · 10 comments · Fixed by #100
Closed

Will there be support on Next.js in the future? #88

kayden1940 opened this issue Sep 15, 2022 · 10 comments · Fixed by #100
Labels
bug Something isn't working

Comments

@kayden1940
Copy link
Contributor

kayden1940 commented Sep 15, 2022

Tried to import anything from rapier, ocurrs error:

Error: Cannot find module '/repo/node_modules/three/examples/jsm/utils/BufferGeometryUtils'

I thinks rapier was trying to get example stuff from three which npm three don't have, hence the error.

Can I tricks rapier to get examples from three-stdlib?

I was running in the latest Next.js, r3f and three.

@AaronClaes
Copy link

same problem here

@Skarian
Copy link

Skarian commented Sep 18, 2022

Same issue as well

@kayden1940 kayden1940 changed the title Support on Next.js? Will there be support on Next.js in the future? Sep 19, 2022
@merveillevaneck
Copy link

would be cool to see this gain support on NextJS as well. not sure if it works on remix but i will run a test on my end to see if it can work.

@firtoz
Copy link
Contributor

firtoz commented Sep 26, 2022

A workaround is to put your scene contents into a dynamic import e.g.

const Content = dynamic(async () => {
  const content = await import('./path-to-content');

  return content.Content;
}, {
  ssr: false,
});

Then it will work only on client side which seems to work well for me.

@merveillevaneck
Copy link

merveillevaneck commented Sep 26, 2022 via email

@hmans
Copy link
Contributor

hmans commented Sep 26, 2022

use @react-three/cannon

use-cannon uses an entirely different physics engine (cannon).

@merveillevaneck
Copy link

merveillevaneck commented Sep 26, 2022 via email

@hmans
Copy link
Contributor

hmans commented Sep 26, 2022

Alright, interesting. Do you know maybe why there are multiple?

I'm not sure I understand the question. Are you asking why multiple physics engines exist?

@merveillevaneck
Copy link

merveillevaneck commented Oct 11, 2022 via email

@isaac-mason
Copy link
Member

isaac-mason commented Oct 11, 2022

To indulge and answer @merveillevaneck's question:

@react-three/cannon was created first. The cannon physics engine is written in JavaScript, and while it's impressive and works for many projects, it has limitations around performance, accuracy, and support for complex shapes (namely limited support for trimeshes).

@react-three/rapier was created recently, and uses the rapier physics engine, which is written in rust. Rapier has much better performance, accuracy, and is more feature complete. The only real gotcha is it has a larger bundle than rt/cannon.

As rt/rapier matures, it will be (and maybe already is) the obvious choice for most projects.

There will still be a place for rt/cannon in some projects that only need very simple physics and a small bundle size. It's also possible that the bundle size for rapier will be reduced in future.


TL;DR rt/cannon is older and has less robust physics, rt/rapier is newer and is more robust + performant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants