1
저는 react-vr에서 새롭고 둘러보기 앱을 만들고 싶습니다. 거기에서 나는 Pano
사진을 업데이트한다. 새 사진을 설정하면 카메라/장면이 새 사진을로드하기 전과 동일한 위치에 있습니다.React-VR은 Pano를 교체 할 때 카메라 위치를 설정합니다.
render() {
if (!this.state.data) {
return null;
}
const locationId = this.state.locationId;
const isLoading = this.state.nextLocationId !== this.state.locationId;
return (
<View>
<Pano
style={{
position: 'absolute'
}}
onLoad={() => {
this.setState({
locationId: this.state.nextLocationId
});
}}
source={asset(this.state.data.photos360[this.state.nextLocationId].uri)}
/>
{tooltips && tooltips.map((tooltip, index) => {
return(
<NavButton
key={index}
isLoading={isLoading}
onInput={() => {
this.setState({
nextLocationId: tooltip.linkedPhoto360Id});
}}
source={asset(this.state.data.nav_icon)}
textLabel={tooltip.text}
rotateY={(tooltip.rotationY && tooltip.rotationY) || 0}
rotateX={(tooltip.rotationX && tooltip.rotationX) || 0}
translateZ={(tooltip.translateZ && tooltip.translateZ) || this.translateZ}
/>
);
})}
</View>
);}
가 지금은 카메라 위치를 설정하거나 내가 사진의 특정 위치에서 시작할 수 있도록 사진을 변환 할 : 여기
는 코드의 일부이다.나는 react-vr에서 실제 카메라 위치를 얻거나 카메라 위치를 설정할 가능성이 없음을 발견했습니다.
이 작업을 수행하는 가장 좋은 방법은 무엇입니까?
도움을 주셔서 감사합니다.
파노라마 사진이 회전 할 때 특정 방향을 바라 볼 수 있도록 파노라마 사진을 회전시키고 싶은 것처럼 들립니다. 그게 무슨 일 이냐면 당신은 pano의 스타일 속성으로 회전을 설정할 수 있습니다. – cidicles
나는 파노를 회전 시키려고했지만 카메라의 실제 회전을 알아야한다. 사용자가 180 ° 회전하여 파노라마를 교체하면 카메라의 회전이 여전히 180 °입니다. 그래서 나는 어떻게 든 카메라의 회전을 가져 와서 내가 생각하는이 값으로 파노라마의 회전을 설정해야합니다. 그러나 나는 로테이션을 얻는 방법을 모른다. – luki
Gotcha - 당신은 VRHeadModel을 찾고 있습니다 : https://facebook.github.io/react-vr/docs/vrheadmodel.html – cidicles