#Why physics engine gets bundled even though I dont use physics?

1 messages · Page 1 of 1 (latest)

idle vigil
#

Hey just noticed that when I export basic scene I also export physics engine which adds 2 mb download for client any clue whats that and if I can just throw it out?

hard bronze
#

Hello, this is on the roadmap to be changed and to only load/be included when you use any physics component / explictly install it. It's something we want to get rid of too

idle vigil
#

Haha, literarily same mistake I made when creating my homebrew exporter. It was a major pain to untangle physics engine from three 😎

hard bronze
#

It shouldnt be a major headache i hope since only few components use it directly. But there are some other things coming first in the version 3 (next week i think) and then we can work on some sort of plugin system / move the physics into their own package maybe. Not 100% sure yet what the best way is

idle vigil
#

Godspeed!

hard bronze
#

Only collider and rigidbody components know anything of it actually and they also just call one already abstracted layer. Just need to move it out or refactor to load lazily (in which case we could keep everything as is and if you start using physics sometime later it could load which would also be a nice option)

#

And obviously not bundle rapier with the engine then. All that is to be figured out 🙂

idle vigil
#

Gotcha, thanks for quick reply

#

😎

hard bronze
#

Do you have any link to your custom engine? Just curious.

idle vigil
#

Nope it's super crude

hard bronze
#

And thanks for asking. So far nobody asked actually haha but just today when updating the vanilly js sample it totally bothered me again how big the js file is mainly because of physics 😐

idle vigil
#

But I pack into three compatibilile JSON

#

which was a major pain to convert verticies and lightmaps still act weird very often

hard bronze
#

A custom json format? Or you serialize to threejs objects from json?

idle vigil
#

Three has its own json format, I made schema for that and serialize into it

hard bronze
#

Gltf was the right decision for us. You can put everything in extensions and load it in three or another tool that has gltf support.

hard bronze
#

The very first version we had heavily relied on js codegen as well. That wouldnt have scaled tho and now we can relatively easily build files that are kind of like a fully serialized scene (it could replace a complete unity scene asset at some point even with interop to blender for example. Its super cool)

idle vigil
#

Yup, I saw you also made monobeheaviour-lite that users can code up in TS

#

Super cool NGL

hard bronze
#

Haha monobehaviour light yeah kind of. With codegen to unity and blender for visual editing if you want 🙂

#

Its a bit confusing for people when first starting since it works the other way around (because you code in typescript) but has many benefits too 🙂

idle vigil
#

For people who are used to three I guess its super fine

hard bronze
#

Hi @idle vigil im curious how your experience is so far and if you did continue using our tools?

idle vigil
#

@hard bronze I probably dont use it enough to give a meaningful feedback.

  1. I was overwhelmed by number of files in generated project (I want to put this into my exisiting astro project, but tedious migration probably cant be avoided?)
  2. I am happy with scene that gets exported as gltf, maybe would be nice to have some way to quickly resize textures before its exported?
#

Hope you dont change the way gltf gets exported because as I start digging into it and adding scripts to control objects in scene any change would be a breaking change

hard bronze
#
  1. How is that project setup? You most likely dont have to use the generated files if you have a project already. Otherwise it would be a good test for us to see what's not yet working if you're willing to share a bit about that (can be via DM)
  2. You can use the Texture import settings in Unity to change max size (compression will be applied when you make a production build - but you can also trigger it manually via the ExportInfo context menu)
hard bronze
idle vigil
#

So for me its great that I can export entire scene and access all the exported objects in a predictable manner

#

As needle evolves and I understand better how to use it I probably wont need my own engine though

#

So godspeed to you guys 😎

#

Right now as I said prototyping with needle is out of question for me, since bundled physics engine is going to drastically affect load times

hard bronze
#

Hello @idle vigil I've got good news for you:

#

Will be available in one of the next updates

#

with rapier:

#

without rapier:

idle vigil
#

You dropped this 👑

#

king of Three