Skip to content

Commit 1047eac

Browse files
Make cursor component work when camera is not an entity like in the inspector (#5614)
* Make cursor component work when camera is not an entity like in the inspector * Assign cameraElParent and do the world transform only if we have a pose
1 parent d26ea9f commit 1047eac

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/components/cursor.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ module.exports.Component = registerComponent('cursor', {
263263
return function (evt) {
264264
var bounds = this.canvasBounds;
265265
var camera = this.el.sceneEl.camera;
266-
var cameraElParent = camera.el.object3D.parent;
266+
var cameraElParent;
267267
var left;
268268
var point;
269269
var top;
@@ -301,6 +301,7 @@ module.exports.Component = registerComponent('cursor', {
301301
origin.copy(transform.position);
302302

303303
// Transform XRPose into world space
304+
cameraElParent = camera.el.object3D.parent;
304305
cameraElParent.localToWorld(origin);
305306
direction.transformDirection(cameraElParent.matrixWorld);
306307
}

0 commit comments

Comments
 (0)