Hi, I was recently going through one of Daniel Shiffman’s old smart rockets tutorial. My code is very similar to his only with updated syntax. I ran into an error early on which was Uncaught TypeError: Cannot read property ‘add’ of undefined. This happens on line 13. Here is my code.
For some reason all of the vectors created in the constructor become undefined when I reference them elsewhere. I have printed them all out to confirm this. I am using the latest version of Atom on Windows 10 and have tested it with both Google Chrome and Firefox. Hope you can help!
Thanks for the feedback. I added a photo of the html file as well. It turns out the issue is fixed if I switch back to ES5 syntax in Atom and It also works with ES5 syntax in the processing IDE. I don’t understand why it does not work with ES6 syntax. I tried Shiffman’s evolutionary steering with ES6 syntax in Atom and it works fine using the same createVector and add properties.