Home Reference Source Repository

js/SceneKit/SCNLookAtConstraint.js

  1. 'use strict'
  2.  
  3. import SCNConstraint from './SCNConstraint'
  4. import SCNNode from './SCNNode'
  5. import SCNVector3 from './SCNVector3'
  6.  
  7.  
  8. /**
  9. * A constraint that orients a node to always point toward a specified other node.
  10. * @access public
  11. * @extends {SCNConstraint}
  12. * @see https://developer.apple.com/documentation/scenekit/scnlookatconstraint
  13. */
  14. export default class SCNLookAtConstraint extends SCNConstraint {
  15.  
  16. /**
  17. * constructor
  18. * @access public
  19. * @constructor
  20. */
  21. constructor() {
  22. super()
  23.  
  24. // Modifying a Constraint
  25.  
  26. /**
  27. * A Boolean value that specifies whether constrained nodes are allowed to rotate.
  28. * @type {boolean}
  29. * @see https://developer.apple.com/documentation/scenekit/scnlookatconstraint/1468675-isgimballockenabled
  30. */
  31. this.isGimbalLockEnabled = false
  32.  
  33. /**
  34. * The node toward which constrained nodes will point after being reoriented.
  35. * @type {?SCNNode}
  36. * @see https://developer.apple.com/documentation/scenekit/scnlookatconstraint/1468677-target
  37. */
  38. this.target = null
  39.  
  40.  
  41. // Instance Properties
  42.  
  43. /**
  44. *
  45. * @type {SCNVector3}
  46. * @see https://developer.apple.com/documentation/scenekit/scnlookatconstraint/2867570-localfront
  47. */
  48. this.localFront = null
  49.  
  50. /**
  51. *
  52. * @type {SCNVector3}
  53. * @see https://developer.apple.com/documentation/scenekit/scnlookatconstraint/2867488-targetoffset
  54. */
  55. this.targetOffset = null
  56.  
  57. /**
  58. *
  59. * @type {SCNVector3}
  60. * @see https://developer.apple.com/documentation/scenekit/scnlookatconstraint/2902240-worldup
  61. */
  62. this.worldUp = null
  63.  
  64. }
  65.  
  66. // Creating a Look-At Constraint
  67.  
  68. /**
  69. * Creates a look-at constraint for a specified target node.
  70. * @access public
  71. * @param {?SCNNode} target - The node that constrained nodes will be reoriented to point toward.
  72. * @returns {void}
  73. * @desc To attach constraints to an SCNNode object, use its constraints property.
  74. * @see https://developer.apple.com/documentation/scenekit/scnlookatconstraint/1468683-init
  75. */
  76. static constraintWithTarget(target) {
  77. const constraint = new SCNLookAtConstraint()
  78. // TODO: implement
  79. return constraint
  80. }
  81. }