Object3D.rst 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239
  1. Object3D - Base class for scene graph objects
  2. ---------------------------------------------
  3. .. ...............................................................................
  4. .. rubric:: Constructor
  5. .. ...............................................................................
  6. .. class:: Object3D()
  7. Base class for scene graph objects
  8. .. ...............................................................................
  9. .. rubric:: Attributes
  10. .. ...............................................................................
  11. .. attribute:: Object3D.id
  12. Unique number of this object instance
  13. .. attribute:: Object3D.name
  14. Optional name of the object (doesn't have to be unique)
  15. .. ...............................................................................
  16. .. rubric:: Scene graph attributes
  17. .. ...............................................................................
  18. .. attribute:: Object3D.parent
  19. Object's parent in scene graph
  20. .. attribute:: Object3D.children
  21. Array with object's children
  22. .. ...............................................................................
  23. .. rubric:: Transform attributes
  24. .. ...............................................................................
  25. .. attribute:: Object3D.position
  26. Object's local position
  27. :class:`Vector3` - default ``( 0, 0, 0 )``
  28. .. attribute:: Object3D.rotation
  29. Object's local rotation (Euler angles)
  30. :class:`Vector3` - default ``( 0, 0, 0 )``
  31. .. attribute:: Object3D.eulerOrder
  32. Order of axis for Euler angles
  33. ``string`` - default ``XYZ``
  34. .. attribute:: Object3D.scale
  35. Object's local scale
  36. :class:`Vector3` - default ``( 1, 1, 1 )``
  37. .. attribute:: Object3D.up
  38. Up direction
  39. :class:`Vector3` - default ``( 0, 1, 0 )``
  40. .. attribute:: Object3D.matrix
  41. Local transform
  42. :class:`Matrix4`
  43. .. attribute:: Object3D.matrixWorld
  44. Global transform
  45. :class:`Matrix4`
  46. .. attribute:: Object3D.matrixRotationWorld
  47. Global rotation
  48. :class:`Matrix4`
  49. .. attribute:: Object3D.quaternion
  50. Rotation quaternion
  51. :class:`Quaternion`
  52. .. attribute:: Object3D.useQuaternion
  53. Use quaternion instead of Euler angles for specifying local rotation
  54. boolean - default ``false``
  55. .. attribute:: Object3D.boundRadius
  56. ``float`` - default ``0.0``
  57. .. attribute:: Object3D.boundRadiusScale
  58. Maximum scale from X, Y, Z scale components
  59. ``float`` - default ``1.0``
  60. .. attribute:: Object3D.renderDepth
  61. Override depth-sorting order if non ``null``
  62. ``float`` - default ``null``
  63. .. ...............................................................................
  64. .. rubric:: Appearance flags
  65. .. ...............................................................................
  66. .. attribute:: Object3D.visible
  67. Object gets rendered if ``true``
  68. ``boolean`` - default ``true``
  69. .. attribute:: Object3D.doubleSided
  70. Both sides of faces visible if ``true``
  71. default ``false``
  72. .. attribute:: Object3D.flipSided
  73. Backside of face visible
  74. default ``false``
  75. .. attribute:: Object3D.castShadow
  76. Gets rendered into shadow map
  77. ``boolean`` - default ``false``
  78. .. attribute:: Object3D.receiveShadow
  79. Material gets baked in shadow receiving
  80. ``boolean`` - default ``false``
  81. .. ...............................................................................
  82. .. rubric:: Scene graph flags
  83. .. ...............................................................................
  84. .. attribute:: Object3D.frustumCulled
  85. ``boolean`` - default ``true``
  86. .. attribute:: Object3D.matrixAutoUpdate
  87. ``boolean`` - default ``true``
  88. .. attribute:: Object3D.matrixWorldNeedsUpdate
  89. ``boolean`` - default ``true``
  90. .. attribute:: Object3D.rotationAutoUpdate
  91. ``boolean`` - default ``true``
  92. .. ...............................................................................
  93. .. rubric:: Methods
  94. .. ...............................................................................
  95. .. function:: Object3D.translate ( distance, axis )
  96. Translates object along arbitrary axis by distance
  97. :param float distance: distance
  98. :param Vector3 axis: translation direction
  99. .. function:: Object3D.translateX ( distance )
  100. Translates object along X-axis by distance
  101. :param float distance: distance
  102. .. function:: Object3D.translateY ( distance )
  103. Translates object along Y-axis by distance
  104. :param float distance: distance
  105. .. function:: Object3D.translateZ ( distance )
  106. Translates object along Z-axis by distance
  107. :param float distance: distance
  108. .. function:: Object3D.lookAt ( vector )
  109. Rotates object to face point in space
  110. :param Vector3 vector: vector
  111. .. function:: Object3D.add ( object )
  112. Adds child object to this object
  113. :param Object3D object: child
  114. .. function:: Object3D.remove ( object )
  115. Removes child object from this object
  116. :param Object3D object: child
  117. .. function:: Object3D.getChildByName ( name, doRecurse )
  118. Gets first child with name matching the argument (searches whole subgraph recursively if flag is set).
  119. :param string name: child name
  120. :param boolean doRecurse: recurse flag
  121. :returns: child with matching name or ``undefined``
  122. :rtype: :class:`Object3D`
  123. .. function:: Object3D.updateMatrix ( )
  124. Updates local transform
  125. .. function:: Object3D.updateMatrixWorld ( force )
  126. Updates global transform of the object and its children
  127. .. ...............................................................................
  128. .. rubric:: Example
  129. .. ...............................................................................