Forum

Camera Reset

27 April 2015 22:05 #2167
So I have created a product viewer to be incorporated into training materials. This viewer allows the user to fly around the object in three dimensional space. I'm having an issue with resetting the camera back to its original position. Upon initialization I capture the following parameters from the camera: Pivot(m_camera.get_pivot), Velocity(m_camera.get_velocity_params), Eye (m_camera.get_eye), and Limits(m_camera.get_cam_dist_limits). When the user clicks the reset button (HTML UI) I reset the following parameters: Pivot(m_camera.set_pivot) and Look At(m_camera.set_look_at). The only time this doesn't work is when I move the camera to a top view and try to reset the camera. It traces the same details as the initial camera capture after the reset, but looks nothing like the initial view. If I change the angle to be more of a 3Q view, it resets perfectly fine. Is this an issue with my calls or a Blend4Web issue? I think that if I add vertical limits to the camera this may help fix the issue as well. Any ideas?
28 April 2015 12:24 #2173
Hi!

I suppose that you have the "TARGET" camera. Try to use set_trans_pivot method. It is more suitable if you want to change camera position and pivot at the same time.

Currently the documentation about this method is incorrect. You should call it as follows:
set_trans_pivot(camera_object, camera_eye, camera_pivot).
Blend4Web Team
28 April 2015 12:36 #2174

set_trans_pivot

Also, it is used in the "Camera Animation" code example. You can reach it from the Code Snippets App in our SDK.
Blend4Web Team
28 April 2015 16:56 #2176
Thanks, I'll try implementing this today. I'll keep everyone posted on the result.
28 April 2015 17:09 #2177
I have implemented the set_trans_pivot and it is doing the same thing, when viewed from a top view. Otherwise it works correctly.
28 April 2015 17:12 #2178
FYI - It is a 'Target' camera.
28 April 2015 17:21 #2179
I applied some vertical limits, instead of being -90, 90, are now -60,60. Setting these values fixed the issue.
28 April 2015 18:05 #2180

Ответ на сообщение пользователя Ryan Uttech
I applied some vertical limits, instead of being -90, 90, are now -60,60. Setting these values fixed the issue.

OK, if this solution fits for you. Thank you for feedback. We will investigate this issue.
Blend4Web Team
28 April 2015 18:13 #2181
I think the camera is confused when set to its max and min vertical limit. The values trace out correctly, but the view is clearly wrong.
28 April 2015 19:59 #2182

Ответ на сообщение пользователя Ryan Uttech
I think the camera is confused when set to its max and min vertical limit. The values trace out correctly, but the view is clearly wrong.

Yes, it was a bug related to the camera's upside down position.
It would be fixed in the upcoming release in the next few days. So, there would be no need to set vertical limits.

Also, I was wrong about the "set_trans_pivot" method. It doesn't keep the correct view (correct vertical aligning). "set_look_at" is more appropriate. Sorry for the confusion.

Blend4Web Team
 
Please register or log in to leave a reply.