Aframe Ray caster Intersection
After Switching to Master build of Aframe The raycaster intersection event seems to become null although i kept the exact same code :
<script src="https://cdn.jsdelivr.net/gh/aframevr/aframe@efcc8a0a919811fe5bd4ab6fd60bfbb8e85a98a1/dist/aframe-master.min.js"></script>
with the Registered Component :
AFRAME.registerComponent('collider-check', {
dependencies: ['raycaster'],
init: function () {
this.el.addEventListener('raycaster-intersected', function (evt) {
console.log(evt.detail.intersection);//this returns null
var intersection=evt.detail.intersection.point;
startTimer(intersection.x,intersection.y,intersection.z);
});
}
});
and the camera where i put the collider-check
<a-entity id="cameraParent" position="0 0 0" >
<a-entity id="cam" camera="zoom:1;" look-controls collider-check position="0 0 0" >
<a-entity cursor=" rayOrigin: mouse"
geometry="primitive: ring; radiusInner: 0; radiusOuter: 0"
material="color: black; shader: flat"></a-entity>
<a-entity raycaster="showLine:true; far: 1000" line="color:orange; opacity:1" ></a-entity>
</a-entity>
</a-entity>
My a-sky where i want to catch intersections
<a-sky class="collidable" id="image-360" radius="200" src="#{{$tour_images[0][0]->name}}" data-image-id="{{$tour_images[0][0]->id}}"></a-sky>
javascript html aframe
add a comment |
After Switching to Master build of Aframe The raycaster intersection event seems to become null although i kept the exact same code :
<script src="https://cdn.jsdelivr.net/gh/aframevr/aframe@efcc8a0a919811fe5bd4ab6fd60bfbb8e85a98a1/dist/aframe-master.min.js"></script>
with the Registered Component :
AFRAME.registerComponent('collider-check', {
dependencies: ['raycaster'],
init: function () {
this.el.addEventListener('raycaster-intersected', function (evt) {
console.log(evt.detail.intersection);//this returns null
var intersection=evt.detail.intersection.point;
startTimer(intersection.x,intersection.y,intersection.z);
});
}
});
and the camera where i put the collider-check
<a-entity id="cameraParent" position="0 0 0" >
<a-entity id="cam" camera="zoom:1;" look-controls collider-check position="0 0 0" >
<a-entity cursor=" rayOrigin: mouse"
geometry="primitive: ring; radiusInner: 0; radiusOuter: 0"
material="color: black; shader: flat"></a-entity>
<a-entity raycaster="showLine:true; far: 1000" line="color:orange; opacity:1" ></a-entity>
</a-entity>
</a-entity>
My a-sky where i want to catch intersections
<a-sky class="collidable" id="image-360" radius="200" src="#{{$tour_images[0][0]->name}}" data-image-id="{{$tour_images[0][0]->id}}"></a-sky>
javascript html aframe
Why are you using the class attribute on the sky element? If you want to whitelist the ray traced entities, you need to add the objects property in the raycaster component. Right now you are testing against all the entities in the scene.
– Camilo
Nov 21 '18 at 16:05
add a comment |
After Switching to Master build of Aframe The raycaster intersection event seems to become null although i kept the exact same code :
<script src="https://cdn.jsdelivr.net/gh/aframevr/aframe@efcc8a0a919811fe5bd4ab6fd60bfbb8e85a98a1/dist/aframe-master.min.js"></script>
with the Registered Component :
AFRAME.registerComponent('collider-check', {
dependencies: ['raycaster'],
init: function () {
this.el.addEventListener('raycaster-intersected', function (evt) {
console.log(evt.detail.intersection);//this returns null
var intersection=evt.detail.intersection.point;
startTimer(intersection.x,intersection.y,intersection.z);
});
}
});
and the camera where i put the collider-check
<a-entity id="cameraParent" position="0 0 0" >
<a-entity id="cam" camera="zoom:1;" look-controls collider-check position="0 0 0" >
<a-entity cursor=" rayOrigin: mouse"
geometry="primitive: ring; radiusInner: 0; radiusOuter: 0"
material="color: black; shader: flat"></a-entity>
<a-entity raycaster="showLine:true; far: 1000" line="color:orange; opacity:1" ></a-entity>
</a-entity>
</a-entity>
My a-sky where i want to catch intersections
<a-sky class="collidable" id="image-360" radius="200" src="#{{$tour_images[0][0]->name}}" data-image-id="{{$tour_images[0][0]->id}}"></a-sky>
javascript html aframe
After Switching to Master build of Aframe The raycaster intersection event seems to become null although i kept the exact same code :
<script src="https://cdn.jsdelivr.net/gh/aframevr/aframe@efcc8a0a919811fe5bd4ab6fd60bfbb8e85a98a1/dist/aframe-master.min.js"></script>
with the Registered Component :
AFRAME.registerComponent('collider-check', {
dependencies: ['raycaster'],
init: function () {
this.el.addEventListener('raycaster-intersected', function (evt) {
console.log(evt.detail.intersection);//this returns null
var intersection=evt.detail.intersection.point;
startTimer(intersection.x,intersection.y,intersection.z);
});
}
});
and the camera where i put the collider-check
<a-entity id="cameraParent" position="0 0 0" >
<a-entity id="cam" camera="zoom:1;" look-controls collider-check position="0 0 0" >
<a-entity cursor=" rayOrigin: mouse"
geometry="primitive: ring; radiusInner: 0; radiusOuter: 0"
material="color: black; shader: flat"></a-entity>
<a-entity raycaster="showLine:true; far: 1000" line="color:orange; opacity:1" ></a-entity>
</a-entity>
</a-entity>
My a-sky where i want to catch intersections
<a-sky class="collidable" id="image-360" radius="200" src="#{{$tour_images[0][0]->name}}" data-image-id="{{$tour_images[0][0]->id}}"></a-sky>
javascript html aframe
javascript html aframe
asked Nov 21 '18 at 11:50
Sandy Al AkhrasSandy Al Akhras
356
356
Why are you using the class attribute on the sky element? If you want to whitelist the ray traced entities, you need to add the objects property in the raycaster component. Right now you are testing against all the entities in the scene.
– Camilo
Nov 21 '18 at 16:05
add a comment |
Why are you using the class attribute on the sky element? If you want to whitelist the ray traced entities, you need to add the objects property in the raycaster component. Right now you are testing against all the entities in the scene.
– Camilo
Nov 21 '18 at 16:05
Why are you using the class attribute on the sky element? If you want to whitelist the ray traced entities, you need to add the objects property in the raycaster component. Right now you are testing against all the entities in the scene.
– Camilo
Nov 21 '18 at 16:05
Why are you using the class attribute on the sky element? If you want to whitelist the ray traced entities, you need to add the objects property in the raycaster component. Right now you are testing against all the entities in the scene.
– Camilo
Nov 21 '18 at 16:05
add a comment |
1 Answer
1
active
oldest
votes
You now have to grab the intersection data manually, it was to prevent memory garbage in the event details.
The event detail provides a convenient references to the method to grab the intersection.
evt.detail.getIntersection(this.el);
Also the raycaster-intersected
event is no longer spammed. It is only called once on intersection start. If you need to spam it, listen for the event, store a variable, and use tick
.
Thank you for your answer but it is still returning null
– Sandy Al Akhras
Nov 21 '18 at 13:16
Also your cursor won't work if it and the raycaster are separate entities. They should be the same entity. The collider-check seem like it should go on the sky since it's theintersected
event. Theintersection
event is what is listened to on the raycaster. So either move the collider-check to sky, or adapt the collider-check to useraycaster-intersection
and attach to raycaster Also theraycaster-intersected
event is no longer spammed. It is only called once on intersection start. If you need to spam it, listen for the event, store a variable, and use tick.
– ngokevin
Nov 21 '18 at 13:25
I am doing this version change due to a problem i faced when i updated chrome and the a-sky went crazy rotating Also the buttons are not workiing on some IOS versions. Is there a soltion i can add in the code besides updating the version of Aframe am using from 0.8.0 to 0.8.2 ?
– Sandy Al Akhras
Nov 23 '18 at 10:32
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53411442%2faframe-ray-caster-intersection%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
You now have to grab the intersection data manually, it was to prevent memory garbage in the event details.
The event detail provides a convenient references to the method to grab the intersection.
evt.detail.getIntersection(this.el);
Also the raycaster-intersected
event is no longer spammed. It is only called once on intersection start. If you need to spam it, listen for the event, store a variable, and use tick
.
Thank you for your answer but it is still returning null
– Sandy Al Akhras
Nov 21 '18 at 13:16
Also your cursor won't work if it and the raycaster are separate entities. They should be the same entity. The collider-check seem like it should go on the sky since it's theintersected
event. Theintersection
event is what is listened to on the raycaster. So either move the collider-check to sky, or adapt the collider-check to useraycaster-intersection
and attach to raycaster Also theraycaster-intersected
event is no longer spammed. It is only called once on intersection start. If you need to spam it, listen for the event, store a variable, and use tick.
– ngokevin
Nov 21 '18 at 13:25
I am doing this version change due to a problem i faced when i updated chrome and the a-sky went crazy rotating Also the buttons are not workiing on some IOS versions. Is there a soltion i can add in the code besides updating the version of Aframe am using from 0.8.0 to 0.8.2 ?
– Sandy Al Akhras
Nov 23 '18 at 10:32
add a comment |
You now have to grab the intersection data manually, it was to prevent memory garbage in the event details.
The event detail provides a convenient references to the method to grab the intersection.
evt.detail.getIntersection(this.el);
Also the raycaster-intersected
event is no longer spammed. It is only called once on intersection start. If you need to spam it, listen for the event, store a variable, and use tick
.
Thank you for your answer but it is still returning null
– Sandy Al Akhras
Nov 21 '18 at 13:16
Also your cursor won't work if it and the raycaster are separate entities. They should be the same entity. The collider-check seem like it should go on the sky since it's theintersected
event. Theintersection
event is what is listened to on the raycaster. So either move the collider-check to sky, or adapt the collider-check to useraycaster-intersection
and attach to raycaster Also theraycaster-intersected
event is no longer spammed. It is only called once on intersection start. If you need to spam it, listen for the event, store a variable, and use tick.
– ngokevin
Nov 21 '18 at 13:25
I am doing this version change due to a problem i faced when i updated chrome and the a-sky went crazy rotating Also the buttons are not workiing on some IOS versions. Is there a soltion i can add in the code besides updating the version of Aframe am using from 0.8.0 to 0.8.2 ?
– Sandy Al Akhras
Nov 23 '18 at 10:32
add a comment |
You now have to grab the intersection data manually, it was to prevent memory garbage in the event details.
The event detail provides a convenient references to the method to grab the intersection.
evt.detail.getIntersection(this.el);
Also the raycaster-intersected
event is no longer spammed. It is only called once on intersection start. If you need to spam it, listen for the event, store a variable, and use tick
.
You now have to grab the intersection data manually, it was to prevent memory garbage in the event details.
The event detail provides a convenient references to the method to grab the intersection.
evt.detail.getIntersection(this.el);
Also the raycaster-intersected
event is no longer spammed. It is only called once on intersection start. If you need to spam it, listen for the event, store a variable, and use tick
.
edited Nov 21 '18 at 13:25
answered Nov 21 '18 at 12:22
ngokevinngokevin
9,05611558
9,05611558
Thank you for your answer but it is still returning null
– Sandy Al Akhras
Nov 21 '18 at 13:16
Also your cursor won't work if it and the raycaster are separate entities. They should be the same entity. The collider-check seem like it should go on the sky since it's theintersected
event. Theintersection
event is what is listened to on the raycaster. So either move the collider-check to sky, or adapt the collider-check to useraycaster-intersection
and attach to raycaster Also theraycaster-intersected
event is no longer spammed. It is only called once on intersection start. If you need to spam it, listen for the event, store a variable, and use tick.
– ngokevin
Nov 21 '18 at 13:25
I am doing this version change due to a problem i faced when i updated chrome and the a-sky went crazy rotating Also the buttons are not workiing on some IOS versions. Is there a soltion i can add in the code besides updating the version of Aframe am using from 0.8.0 to 0.8.2 ?
– Sandy Al Akhras
Nov 23 '18 at 10:32
add a comment |
Thank you for your answer but it is still returning null
– Sandy Al Akhras
Nov 21 '18 at 13:16
Also your cursor won't work if it and the raycaster are separate entities. They should be the same entity. The collider-check seem like it should go on the sky since it's theintersected
event. Theintersection
event is what is listened to on the raycaster. So either move the collider-check to sky, or adapt the collider-check to useraycaster-intersection
and attach to raycaster Also theraycaster-intersected
event is no longer spammed. It is only called once on intersection start. If you need to spam it, listen for the event, store a variable, and use tick.
– ngokevin
Nov 21 '18 at 13:25
I am doing this version change due to a problem i faced when i updated chrome and the a-sky went crazy rotating Also the buttons are not workiing on some IOS versions. Is there a soltion i can add in the code besides updating the version of Aframe am using from 0.8.0 to 0.8.2 ?
– Sandy Al Akhras
Nov 23 '18 at 10:32
Thank you for your answer but it is still returning null
– Sandy Al Akhras
Nov 21 '18 at 13:16
Thank you for your answer but it is still returning null
– Sandy Al Akhras
Nov 21 '18 at 13:16
Also your cursor won't work if it and the raycaster are separate entities. They should be the same entity. The collider-check seem like it should go on the sky since it's the
intersected
event. The intersection
event is what is listened to on the raycaster. So either move the collider-check to sky, or adapt the collider-check to use raycaster-intersection
and attach to raycaster Also the raycaster-intersected
event is no longer spammed. It is only called once on intersection start. If you need to spam it, listen for the event, store a variable, and use tick.– ngokevin
Nov 21 '18 at 13:25
Also your cursor won't work if it and the raycaster are separate entities. They should be the same entity. The collider-check seem like it should go on the sky since it's the
intersected
event. The intersection
event is what is listened to on the raycaster. So either move the collider-check to sky, or adapt the collider-check to use raycaster-intersection
and attach to raycaster Also the raycaster-intersected
event is no longer spammed. It is only called once on intersection start. If you need to spam it, listen for the event, store a variable, and use tick.– ngokevin
Nov 21 '18 at 13:25
I am doing this version change due to a problem i faced when i updated chrome and the a-sky went crazy rotating Also the buttons are not workiing on some IOS versions. Is there a soltion i can add in the code besides updating the version of Aframe am using from 0.8.0 to 0.8.2 ?
– Sandy Al Akhras
Nov 23 '18 at 10:32
I am doing this version change due to a problem i faced when i updated chrome and the a-sky went crazy rotating Also the buttons are not workiing on some IOS versions. Is there a soltion i can add in the code besides updating the version of Aframe am using from 0.8.0 to 0.8.2 ?
– Sandy Al Akhras
Nov 23 '18 at 10:32
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53411442%2faframe-ray-caster-intersection%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Why are you using the class attribute on the sky element? If you want to whitelist the ray traced entities, you need to add the objects property in the raycaster component. Right now you are testing against all the entities in the scene.
– Camilo
Nov 21 '18 at 16:05