Common 3D Programming Errors
Keep the JavaScript console open for this section. After the closing curly brace of the eat function, add a blank line and then type the highlighted code.
â | âfunctionâ eat(food) { |
â | console.log(food, â'!!! Nom. Nom. Nom'â); |
â | } |
â | |
» | âvarâ shape = ânewâ THREE.SpherGeometry(100); |
» | âvarâ cover = ânewâ Three.MeshNormalMaterial(); |
» | âvarâ ball = ânewâ THREE.Mesh(shape, cover); |
» | scene.ad(ball); |
Youâll notice that the editor does not see any errors in this code. The browser reads the JavaScript code and says, âYup, that looks like perfectly fine JavaScript to me. Iâll run it now!â However, problems pop up when the code is actually run, and youâll see errors in the JavaScript ...
Get 3D Game Programming for Kids, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.