Retrieving position and rotation from activeCamera

Hi there:

I have my scene’s active camera animated from a GLTF. It works great.

The case is that, when the animation ends, I want to access the position and orientation of that camera, but scene.activeCamera.position and scene.activeCamera.rotation returns a Zero vector.

What am I doing bad?

Must I instead copy position and orientation from the AnimationGroups?

Thanks for your time!

could you share a repro in the playground ? this would help a lot addressing the issue.

Good morning, @sebavan:

Of course. Please take a look at it by visiting this link.

Te point is that, after the camera animation reach its final frame, I can’t retrieve its position and/or orientation, as both have been (apparently) cleared out.

Thanks for your time!

Does camera._globalPosition have the correct value?
Seems like you may be able to use _tmpTargetVector to get the target too…

Haven’t run into this specific issue, so I’m not sure if that will work, but curious what you find.

Hi, @Nowayz:

Thanks for your time.

Well, camera.globalPosition does the trick but, sadly, is not the same with the obvious counterpart camera.globalOrientation.

Maybe is needed then a workaround, using camera.getTarget, as an option. It returns some apparently coherent values, as you can see in this PG.

Nevertheless, I find it a little counterintuitive… not being able to use simply camera.position and camera.orientation. Isn’t it?

This is pretty much expected like on Transform/Mesh position and rotation are the local values and in your example, what is animating are the parent transforms, not the camera node itself

About the rotation you can access the world space one through absoluteRotation

Thanks for the info, @sebavan. That’s really very appreciated.

Anyway, maybe having globalPosition on a hand, but absoluteRotation on the other is a little not very clean. Isn’t it?

In addition, for sure all these group nodes (transformation nodes) are a great deal when you look at the whole picture of a 3D engine, and want to have all the flexibility; but in a day-by-day basis of work with 3d artists, and of course through the “special” behavior of the different exporters involved, we have there a continuous source of problems.

Very important to have always a hundred eyes on it.

Again, thanks for your time!

yup agree the consistency here is more than doubtful :slight_smile:

Would it acceptable to create alias for these to remain backwards compatible but also attempt to move toward consistency?

yup lets check with @PolygonalSun and @RaananW for this one :slight_smile: