garbo-succus / r3f-control-kit

Composable camera controls for react-three-fiber
20 stars 1 forks source link

SimpleOrbitCamera API #5

Closed neftaly closed 1 year ago

neftaly commented 1 year ago

Implement same API as https://github.com/garbo-succus/r3f-simple-orbit-camera, with an additional "animation" prop for a fn that handles the animation of the current transition. Functions such as min/max angle should be pulled out of component and provided as a helper library.

This would fix #1 #2

neftaly commented 1 year ago

at the moment the camera state is provided by an internal zustand state subscription. this is fast, whereas supplying props to the react component is expensive. doing this change optimizes for camera animations, but adds a bottleneck when user imput is directly manipulating the camera. there should be an escape hatch for direct camera manipulation (maybe through animation fn?)

neftaly commented 1 year ago

maybe make it possible to pass a stream in as an argument (can zustand be passed as an argument)? not sure how min/max angle function ties into this

neftaly commented 1 year ago

another approach is to add a useOrbitCamera hook

neftaly commented 1 year ago

merged changes (stream as argument)