Ocean Component does not register clicks when using Cursor Component Tutorial #105

Closed
JGL opened this Issue Nov 8, 2016 · 1 comment

Projects

None yet

2 participants

@JGL
JGL commented Nov 8, 2016

Following the Cursor tutorial here:
https://aframe.io/docs/0.3.0/components/cursor.html
I made a pair of components - one to change the ocean material side property to Double instead of Front sided:
https://github.com/JGL/APieceOfArtAsBigAsIndia/blob/master/src/js/material-side-modifier-ocean.js
And the other as a listener to the Cursor component:
https://github.com/JGL/APieceOfArtAsBigAsIndia/blob/master/src/js/cursor-listener.js
A demonstration of the side modifier in action can be seen here:
https://jgl.github.io/APieceOfArtAsBigAsIndia/oceanComponentWithMyComponent.html
A demonstration of the click not being triggered can be seen here:
https://jgl.github.io/APieceOfArtAsBigAsIndia/collidingWithOceanComponent.html
You can see the same Cursor Listening with the Mountain Component here:
https://jgl.github.io/APieceOfArtAsBigAsIndia/collidingWithMountainComponent.html

@donmccurdy
Owner

Looks like the A-Frame raycaster ignores intersections with objects that don't have an entity attached:

// raycaster.js
// Only keep intersections against objects that have a reference to an entity.
intersections = intersections.filter(function hasEl (intersection) {
    return !!intersection.object.el;
});

In my code here, I call el.object3D.add(this.mesh);. Presumably I should be using el.setObject3D('mesh', this.mesh); instead, and that would automatically set mesh.el.

Traveling today, and will get that patched when I'm back. Or would take a PR as well. :)

@donmccurdy donmccurdy added the bug label Nov 8, 2016
@donmccurdy donmccurdy added a commit that closed this issue Nov 11, 2016
@donmccurdy Use setObject3D() for <a-ocean />
Fixes #105.
a162ca6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment