最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - React Three Fiber OrbitControls Initial zoom wider - Stack Overflow

programmeradmin2浏览0评论

I am working on this codesandbox to do practice with React Three Fiber.

My question with the demo is that i do not really understand how i can set the initial zoom way wider in OrbitControls in order that i can see more small stars?

This is the relevant code where i think i need to pass the zoom values

<OrbitControls
    enableZoom={true}
    enablePan={true}
    enableRotate={true}
/>

I was digging in the official website to understand what is actually needed for OrbitControls to configure the initial zoom

I am working on this codesandbox to do practice with React Three Fiber.

My question with the demo is that i do not really understand how i can set the initial zoom way wider in OrbitControls in order that i can see more small stars?

This is the relevant code where i think i need to pass the zoom values

<OrbitControls
    enableZoom={true}
    enablePan={true}
    enableRotate={true}
/>

I was digging in the official website to understand what is actually needed for OrbitControls to configure the initial zoom

Share Improve this question edited Jun 5, 2024 at 9:59 Samuel RIGAUD 1,7061 gold badge17 silver badges27 bronze badges asked Apr 11, 2022 at 11:05 Koala7Koala7 1,4248 gold badges43 silver badges88 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 6 +50

You can set the camera's initial position further away. In three.js you would do:

camera.position.set(x, y, z); // The point where you want the camera
controls.update();

Seems to work in this demo as well. Try e.g. moving away on the x axis:

<PerspectiveCamera
  makeDefault
  position={[500, 0.9, 1.8]}
  fov={60}
  zoom={0.9}
/>

See sandbox fork.

发布评论

评论列表(0)

  1. 暂无评论