react-three-renderer icon indicating copy to clipboard operation
react-three-renderer copied to clipboard

Add 'up' property to Object3D

Open Blackth0rn opened this issue 8 years ago • 2 comments

Added the 'up' property to the Object3DDescriptor class to allow setting the 'up' vector for cameras (and other objects), see: https://threejs.org/docs/?q=Cam#Reference/Core/Object3D.up for THREE documentation on the property.

Added a brief item to the documentation for the Object3D class to note the new property being added.

Blackth0rn avatar Jan 16 '17 06:01 Blackth0rn

Hmm... this is one of those special cases where we may need to decide on priority:

  • quaternion
  • rotation
  • forward (missing from three) and up (not missing)

I am thinking if quaternion exists use that, then rotation, then fwd/up perhaps? Any thoughts?

toxicFork avatar Jan 26 '17 18:01 toxicFork

I hadn't thought of that, was just following what three.js had and trying to work out why my camera was sideways :)

Using the rotation or quaternion sounds pretty reasonable however from looking in the three.js source it seems that the 'up' property is only used by the Object3D.lookAt function. In this function (https://github.com/mrdoob/three.js/blob/dev/src/core/Object3D.js#L274) the rotation/quaternion seem to be ignored so I guess the 'up' value could be defaulted to the rotation/quaternion if the 'up' prop isn't set on an Object3D, which would be the opposite priority order to what you have listed though. 'up' is used if set, if not then check for a quaternion or rotation and use that?

Blackth0rn avatar Jan 31 '17 05:01 Blackth0rn