-
Notifications
You must be signed in to change notification settings - Fork 485
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for Panning to rotate 360Video - Can't set Camera's local rotation #103
Comments
Thank you for your support,
I have already done PanResponder to work, but I have a big problem with the
rotation.
when using Panresponder, we have:
onPanResponderMove: (evt, gestureState) => {
this.videoRef.setNativeProps({
rotation: [gestureState.y0 - gestureState.moveY, gestureState.x0 - gestureState.moveX, 0]
});
},
(gestureState.y0 - gestureState.x0) is the part the we swipe our fingers
from top to bottom or bottom to top.
But I 'm not able to make it work like Facebook, as you can see it turns
around (this part is really difficult to describe).
I mean that it is not from top-bottom, but leftTop-leftBottom, it turns
like a curve.
2017-12-06 9:05 GMT+07:00 Manish Bodhankar <[email protected]>:
… Hello,
Thanks for reaching out to us! Our component has a rotation prop. We just
noticed we skipped adding that to our documentation. Will go ahead an add
it. But in the meantime, you can set rotation of the video as follows
<Viro360Video source={require(“./video/myvideo.mp4”)} rotation={[0,
this.state.rotationY,0]} loop={true} paused={false} volume={1.0} />
You should be able to take your PanResponder and translate the touch
movement coordinates to how much you want to rotate the video by.
If the above doesn’t work, do share code snippets of how you are trying to
achieve the above. We’d be happy to help.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#103 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AM5BAb6ciCSs0oREkKLQlftQVGQ59X6Uks5s9fZygaJpZM4Q1uQf>
.
--
----------
*Phạm Gia Khánh (Mr)*
*Email: *[email protected]* | **Cell phone:** (+84) *1662 95 2222
*Student of Information System Department, SOICT*
------------------------------------------------------------------------
*Hanoi University of Science and Technology *
*Address: No.1 Dai Co Viet, Hai Ba Trung, Ha Noi*
*Website: **http://www.hust.edu.vn/ <http://www.hust.edu.vn/>*
|
Hi @vjtc0n, I've attempted to get a working code example as shown in the screen shot below: The sample code for containing the panResponder and moving the view point is as shown:
If you do want to enable vertical rotation as well, so that the user can then pan up and down at the same time, you would hit a Viro Bug - There is an issue where setting the camera rotation does not consider the device’s current ‘head/tilt rotation’, resulting in a bug where the camera does not rotate along the forward vector of where it is currently facing in. For example, the user can turn his device left, pan up and down, and this would result in the world “titlting to the right”. As a mitigation, I would suggest locking the camera to only rotate horizontally, as shown in the example code above. This should still give the user the freedom to "move / rotate" in these scene, where the user can pan, then look around, and then pan again. With regards to adding vertical rotation support, I'll rename this bug to properly and more accurately reflect the ask that is required to achieve this. I will also be filing a bug on our back log so we can take a look at this. As soon as this is patched in a future release, we'll update this issue. |
Thank you, Viro Team. |
Hello @dthian , thank you for your support. |
Hi @vjtc0n, unfortunately you will not be able to achieve any animation with the code sample above - this is because the while loop will most likely be executed (looped to it's satisfying condition) in a very quick succession within the duration of a frame. To achieve an animation look, you would need to:
Note for step 2 above, you might need to call it twice with run:false then run:true because of how react handles states. You can view more of the animation guides here Let us know if you experience any problems trying to achieve this. |
Here is my sample code, it does nothing. |
Hmm, VR360Video may not support animations at this time. However, I would strongly recommend to animate a ViroCamera in the scene, rather than the scene around the camera - could you try that instead and see if it works? Adding a camera should be as simple as
Let us know if it doesn't work and we'll take a look at it first thing tomorrow |
Now the animation works like a charm, but I faced another problem. How could I dynamically fix this? |
Hey @vjtc0n, could you also try setting rotateX and rotateZ to 0 as well? |
Closing this issue due to inactivity. Please reopen if the solution above did not work for you. |
Hey @dthian but where that I have to put the {...this._panResponder.panHandlers}
I don't get anything when I'm panning but If I remove block and his content I get events of PanResponder, so I don't know what I have to do to get PanResponder data |
Hi @intimateo, thanks for reaching out unfortunately the above mitigation only works for Android platforms (the pan handlers would be applied to a parent React view that encapsulates ViroVRSceneNav). This is because on iOS, Google's own GVR controls creates a window on top of React's views, effectively "Eating up" all events. Thus, when you remove ViroVRSceneNav (and therefore GVR), pan handlers work properly as intended. Apologies for the roundabout approach / explanation. To get around this, we plan to build native pan handling support - You can track the progress of this here. Please chime in there as well that you need this support so that we can have better numbers on priority. |
How to support this in android with java code as there is no panResponder in android? |
still no support for vertical rotation of the camera ? |
Hello Viro Team,
I haven't found out any ways to use (a) finger(s) to change the view in Viro360Video (just mono mode, not cardboard).
I also tried to use PanResponder but still not working.
For example, when we want to change the view, we must turn around our bodies, therefore changing the view.
Now I want to use fingers to turn around the view, just like facebook VRVideo, any chances to do this right now?
Thank you!
The text was updated successfully, but these errors were encountered: