protyze/aframe-alongpath-component

Not completly working with aframe 0.8.2 anymore

Closed this issue · 1 comments

zen85 commented

I tried to use the aframe-along-path component in aframe 0.8.2 but found a bug that is not happening in aframe 0.7.0 which messes with the example code. it is not possible to detect triggerpoints anymore.

"Uncaught TypeError: Cannot read property 'target' of null
at HTMLElement. (index2.html:405)
at HTMLElement. (a-node.js:297)
at i.updateActiveTrigger (aframe-alongpath-component.min.js:1)
at i.tick (aframe-alongpath-component.min.js:1)
at HTMLElement.value (a-scene.js:593)
at HTMLElement.value (a-scene.js:641)
at bind.js:12
at y (three.js:21940)"

it happens at these lines of code:

var curvepoints = document.querySelectorAll("#path_close > a-curve-point");
    for (var i = 0; i < curvepoints.length; i++) {
        curvepoints[i].addEventListener("alongpath-trigger-activated", function(e){
            var bot = document.querySelector("#bot");
			var mover = document.querySelector("#modelcage");
                switch(e.detail.target.id) {
                case "checkpoint3":
                    AFRAME.utils.entity.setComponentProperty(mover, "alongpath.curve", "#path_takeoff");
					AFRAME.utils.entity.setComponentProperty(mover, "alongpath.dur", "7000");
					AFRAME.utils.entity.setComponentProperty(mover, "alongpath.rotate", "true");
					AFRAME.utils.entity.setComponentProperty(bot, "animation-mixer", "clip: flying; crossFadeDuration: .3");
					
					break;
               
            }
        });
    }

it seems that "switch(e.detail.target.id)" is not supported anymore? what can be used instead now?

i am using:

<script src="https://aframe.io/releases/0.8.2/aframe.min.js"></script>
<script src="https://rawgit.com/protyze/aframe-curve-component/master/dist/aframe-curve-component.min.js"></script>
  <script src="https://rawgit.com/protyze/aframe-alongpath-component/master/dist/aframe-alongpath-component.min.js"></script>

in my header btw...

zen85 commented

the github-issues section of aframe was of great help with this problem.

the solution is to change "e.detail.target.id" to "e.target.id". this should be changed or mentioned in the example code.?

credit goes to @dmarcos for pointing that out.