MCPcopy
hub / github.com/aframevr/aframe / getOrCreateObject3D

Method getOrCreateObject3D

src/core/a-entity.js:174–183  ·  view source on GitHub ↗

* Gets or creates an object3D of a given type. * * @param {string} type - Type of the object3D. * @param {string} Constructor - Constructor to use to create the object3D if needed. * @returns {object}

(type, Constructor)

Source from the content-addressed store, hash-verified

172 * @returns {object}
173 */
174 getOrCreateObject3D (type, Constructor) {
175 var object3D = this.getObject3D(type);
176 if (!object3D && Constructor) {
177 object3D = new Constructor();
178 this.setObject3D(type, object3D);
179 }
180 warn('`getOrCreateObject3D` has been deprecated. Use `setObject3D()` ' +
181 'and `object3dset` event instead.');
182 return object3D;
183 }
184
185 /**
186 * Add child entity.

Callers

nothing calls this directly

Calls 2

getObject3DMethod · 0.95
setObject3DMethod · 0.95

Tested by

no test coverage detected