0

Why my code stops itself after half rotation during animation and I get the waring something related to 'raycaster'. Any idea how to fix it? enter image description here Could anyone suggest the possible mistake I am doing?

1 Answer 1

2

You're probably using a cursor. a-frame cursors use raycasting to check for intersections. The console warns you, that it would be more performant to provide a list of objects you want to be interactable.

You can whitelist objects by providing their selectors (for example by class):

raycaster="objects: .interactable"

For example here you can interact only with objects which class include interactable:


<script src="https://aframe.io/releases/1.2.0/aframe.min.js"></script>
<a-scene cursor="rayOrigin: mouse;" raycaster="objects: .interactable">
  <a-box position="-1 0.5 -3" rotation="0 45 0" class="interactable"
    animation__on="property: scale; to: 1.2 1.2 1.2; dur: 200; easing: linear; 
    startEvents: mouseenter"
    animation__out="property: scale; to:  1 1 1; dur: 200; easing: linear;
    startEvents: mouseleave"
   color="#4CC3D9"></a-box>
   
  <a-box position="1 0.5 -3" rotation="0 45 0"
    animation__on="property: scale; to: 1.2 1.2 1.2; dur: 200; easing: linear; 
    startEvents: mouseenter"
    animation__out="property: scale; to:  1 1 1; dur: 200; easing: linear;
    startEvents: mouseleave"
   color="#AAFFaa"></a-box>
</a-scene>

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.