The question is not directly related to threejs but, I was told that three-bvh-csg will enable me to do what I want with my project, find and create the geometry of the intersection of 3D
objects displayed in my 3D three.js scene.
I look through some examples that the three-bvh-csg provides and I find one that I’m
going to take as an example.
Unfortunately, I have some difficulties to add this dependency in my project.
Does anyone have a pointer, or could tell me how to configure my project
so that I can call three-bvh-csg class and method?
explain to me like I’m five.
For example, here how I call the threejs dependencies in my project:
Please use a build-workflow in which your code needs to compile. There are plenty of tools available that do this automatically for you - for example when you save a file in your editor - and even have your browser reload automatically, or reload the exact changed component (HMR).
The first thing you need it to understand how dependencies work (package.json).
Don’t let anyone tell you to dive into vite or other build tools straight away. It is very valueable to at least have a basic understanding what the underlying technique does in order to troubleshoot your own obstacles that may arise.
Thanks for your reply.
Unfortunately, I can’t use npm.
The project I’m working on is an old legacy php project.
I’ve just added some 3D canevas to some pages that the php serves.
It works well so far.
In one of theses pages, I’d like to compute the intersection of two object. No more no less, I don’t want to add other features.
No, it’s plain PHP, the previous developer build his own MVC framework.
Good, currently my the project has this architecture:
This folder contains mypage.php where myApp.js is called with:
<script async src="https://ga.jspm.io/npm:firstname.lastname@example.org/dist/es-module-shims.js" crossorigin="anonymous"></script>
myClass1.js that my app use and need to import three-bvh-csg:
vendor\composer where phpcomposer puts the php dependency.
Here is a github repo with content you can drop anywhere you want (you don’t really need the files, just copy the code you need).
bvh-csg require the classic bvh to work. Then you need to edit GLTFloader script to get BufferGeometryUtils.js path fixed. A demo link is included in the repo, index.html contain the additional code you need. (line 55-60)
Take note it’s a custom way of doing things to dodge npm easily. Not a recommended production way
If you want you can combine these infos with @winnip_fr answer and properly achieve this using npm.
Thanks for your solution.
I’m aware that is not the proper way of doing it but the code you provide helps me a lot to do what I’d like to do…
I’d like to use npm and vite but frankly I’m lost with theses tools…
Every PHP project has a DOCUMENT_ROOT. It’s where your index.php file lives.
my bad, I wanted to say that the former developper didn’t use any PHP framework, he developped his own MVC framework… I agree with you concening the security but my customer want me to add some 3D fancy stuff first.
Have you any website, book or whaterver that I can read in order to build a proper achitecture of this legacy project?