Comments (9)
Hi, @forerunrun, thanks! Do you have maybe a sandbox to replicate the issue? R3M (react-three-map) doesn't alter geometries or the scene object matrices, only the camera matrices.
from react-three-map.
@forerunrun maybe this version helps?
from react-three-map.
@forerunrun, in coordsTovector3
change from - angle
to + angle
to flip the interpretation. Then you can have your mesh facing Z-up (sandbox) ✌️
![image](https://private-user-images.githubusercontent.com/2405611/274844404-aa6a3f56-63a6-49bf-84bf-3c7d94cc73bf.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTczMzM3ODMsIm5iZiI6MTcxNzMzMzQ4MywicGF0aCI6Ii8yNDA1NjExLzI3NDg0NDQwNC1hYTZhM2Y1Ni02M2E2LTQ5YmYtODRiZi0zYzdkOTRjYzczYmYucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDYwMiUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA2MDJUMTMwNDQzWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9ZGJkYzY5NWVhNTIyMzUwMDQ5NDZhMGRlYjc3YjI0NWJkYzc1MGJkM2JjNWVkYTJlNTZiNjhjYmIwMmQzMDQ0ZCZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.e7D06Bc016wKapQaiTOubno4lwKZAyjWEKfbTWlqc14)
from react-three-map.
As an update, the <Coordinates>
component works perfectly for individual meshes, I'm wondering if there's a way to simply expose the underlying function behind the <Coordinates>
component so an array of vectors (3 or 2) could be set from the same function and passed to Shape
and or BufferGeometry
respectively, this way geometries could be absolutely positioned on the map derivative of their vertex positions...
from react-three-map.
Hi @RodrigoHamuy, thanks for the response, yes i've put together a quick repro of the issue here it's difficult to see the extrude geometry because it's not being evaluated correctly but it's the little thin green line... please let me know if you see anything out of the ordinary with the setup, maybe i've used something wrong but the way it is I'd have imagined each point of the shape to have been in it's correct location
from react-three-map.
@forerunrun the issue is that you are using coordinate points to define a ThreeJS mesh, but as soon as you are in ThreeJS, evertyhing is in meters units. So you need to convert your coordinates to meters. I wrote an example of how to do that here.
from react-three-map.
I wrote an example of how to do that here.
oh @RodrigoHamuy that's amazing, thank you! I completely overlooked that! one thing is that there seems to be an odd rotation to the shape, the back of the shape, based on the coordinates, should be parralel to the blue line in the following image...
would you have an idea why that rotation is off? I'm going to have a proper look into the coordsTovector3 method you've written to try to look into it now...
EDIT: it looks like it's around 22 degrees ( euler.set(0, (22 - angle) * MathUtils.DEG2RAD, 0);
) off but cant quite tell what side is what with the shape in question or why the rotation is off, I'll have a play with a less regular shape
EDIT2: _euler.set(0, (90 + angle) * MathUtils.DEG2RAD, 0);
seems to give the correct orientation to the regular shape too but will double check with an irregular one and confirm
from react-three-map.
@RodrigoHamuy that's great thank you so much for looking into this, yes that definitely helps, i still can't tell why the extrude geometry is off, it should be right, if for instance on the extrude geometry mesh we use <mesh rotation={[90 * MathUtils.DEG2RAD, 0, 0]}>
rather than -90 the orientation looks correct but the mesh is effectively upside down, both lines and extrusions are really useful in different cases so i'll try getting to the bottom of this! thanks again for your help!
from react-three-map.
in
coordsTovector3
change from- angle
to+ angle
to flip the interpretation.
Hey @RodrigoHamuy the problem with that is it then changes the orientation of the <Line/>
in the same way... i ended up just using <mesh rotation={[90 * MathUtils.DEG2RAD, 0, 0]}>
and changing the scale of the up axis to -1 for the extrude geometry mesh which seems to work...
one other thing i've noticed is the raycasting accuracy is strangely off when the map is zoomed out and an object appears small... for instance in one of your official examples here...
in the above image the mouse is currently over the lowest left cube (although you can't see it, it is ) but the onPointerOver event is not being detected for some reason, i'm thinking it's possibly a raycaster misprojection maybe?
Let me know if you'd want me to open this in another issue (unless you know of this already) I've marked the original issue as closed for now as it was user controlled behaviour.
from react-three-map.
Related Issues (20)
- A Circle with 1km Radius HOT 1
- Drei <Html transform /> flickering HOT 4
- I Get the "THREE.WebGLRenderer: WebGL 1 is not supported since r163." when rendering a canvas HOT 1
- line with coordinates as points HOT 2
- Light sources not applied within `<Coordinates>` HOT 2
- Allow to set a custom layer ID, and layer properties HOT 4
- Raycasting inaccuracy
- using <EffectComposer> or <Effects> from r3/drei HOT 2
- mercator line HOT 1
- Pinpoint scale effect HOT 1
- Integration inside another canvas HOT 4
- Models below surface clipped at certain camera angles HOT 1
- Use ThreeJS as a canvas overlay
- Base map HOT 1
- Adding Mapbox 3D buildings HOT 1
- React Native HOT 1
- Object controls on top of 3D Map HOT 5
- Checking whether or not the 3D environment is inside the polygon HOT 2
- Examples Error HOT 1
- Google WebGL maps? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-three-map.