Skip to content
This repository has been archived by the owner on Mar 28, 2019. It is now read-only.

Export camera with an extra parent node #265

Closed
Lee-Heisenbug opened this issue Jul 13, 2018 · 4 comments
Closed

Export camera with an extra parent node #265

Lee-Heisenbug opened this issue Jul 13, 2018 · 4 comments

Comments

@Lee-Heisenbug
Copy link

Lee-Heisenbug commented Jul 13, 2018

There's a .blend file which has a scene with an animated camera.
animated_camera.zip

After I exported the whole scene and the camera( with the "Export cameras" checked ), the exported gltf file showed that the camera got an extra parent node. And the camera's rotation.x was -Math.PI/2 (the order was "XYZ"). I managed to palyed the camera animation using three.js and it was fine. After the end of animation, I tried to use THREE.Orbitcontrol. But the camera seemed uncontrollable. I thought the orbitcontrol may only control the camera's transformation. I pulled the camera out of it's parent node and made it apply it's parent's matrix and add it to the scene so that the camera's status was the same as before. And now I'm able to control the camera with orbitcontrol.

But what if I want to play the animation again? Am I supposed to put the camera in the parent node and set the camera's rotation=-Math.PI/2? That's kind of inconvenient, right?

Is there a way to export the camera without an extra parent node?

@Lee-Heisenbug Lee-Heisenbug changed the title Export camera with a parent node Export camera with an extra parent node Jul 13, 2018
@donmccurdy
Copy link
Contributor

donmccurdy commented Jul 13, 2018

See #113 — omitting that parent node is not straightforward. Perhaps you could use THREE.OrbitControls to control the camera's parent, rather than the camera itself?

@Lee-Heisenbug
Copy link
Author

Lee-Heisenbug commented Jul 16, 2018

I've tried to control the camera's parent using THREE.OrbitControls. But there are some issues:

  • The THREE.OrbitControls doesn't seem to fully support controlling object( camera's parent )
  • The camera's look-at-direction seems different from it's parent's

I've made a fiddle: https://jsfiddle.net/Lee_Heisenbug/h0mky27p/
The camera's rotation.x is set to -Math.PI/2.
origin

I'll keep looking at it.

@donmccurdy
Copy link
Contributor

Seems like the remaining issues are likely threejs-related, feel free to open something on the forum (http://discourse.threejs.org/) or Stack Overflow if you still need help with this.

@Lee-Heisenbug
Copy link
Author

@donmccurdy I can find a way to work with the camera. I guess I have to live with it, since the exporter is not going to change currently.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants