You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is there a way to access the camera controls to be able to zoom to the objects of my 3d scene? For now 'controls' property is always null when I try to access it via useThree hook
Thanks!
The text was updated successfully, but these errors were encountered:
@rokez98 the camera is controlled by MapLibre/Mapbox. So this is out of the scope of react-three-map and more to do with react-map-gl.
Never the less, here is one way to achieve this. If you know your objects coordinates (lat long) and desired zoom level, you can use the map provider easeTo function.
Here is a declarative way to do it for example:
constEaseTo=({latitude, longitude, zoom})=>{constmap=useMap();useEffect(()=>{if(!map.current)return;map.current.easeTo({center: {lon: longitude,lat: latitude},
zoom,duration: 0.3,})},[map,latitude,longitude])return<></>})// use as <EaseTo latitude={number} longitude={number} zoom={number} />
Hi, I have a question regarding camera controls.
Is there a way to access the camera controls to be able to zoom to the objects of my 3d scene? For now 'controls' property is always null when I try to access it via useThree hook
Thanks!
The text was updated successfully, but these errors were encountered: