简体   繁体   English

BabylonJS从外部文件执行脚本

[英]BabylonJS Execute Script from External File


I'm having a (simple) issue, but I have no idea how to fix it. 我有一个(简单的)问题,但是我不知道如何解决。 Essentially, every tutorial I have come across for Babylon puts all of the Javascript code inside < script > tags in the main HTML page. 本质上,我为Babylon遇到的每个教程都将所有Javascript代码放在HTML主页中的<script>标记内。

However, I would like to have all of my Javascript code inside a separate file. 但是,我想将所有Javascript代码放在一个单独的文件中。 I have tried every way of loading it as I could think of, though I am a novice at Javascript (I am decent at C++, and I can see the similarities); 尽管我是Javascript的新手(我在C ++上很体面,并且可以看到相似之处),但我已经尝试了各种尝试加载它的方法。 yet I was unable to make it load. 但我无法加载它。 (It works fine when called from the HTML page itself). (从HTML页面本身调用时,效果很好)。

Does anyone know what (if anything) I can do in order to be able to load my scripts from external files, and still get everything to work? 有人知道我可以做什么(如果有的话),以便能够从外部文件加载我的脚本,并且仍然可以正常工作?

Thanks in advance! 提前致谢!

2 options: 2种选择:

Enjoy and thanks for using Babylon.js! 享受并感谢您使用Babylon.js! :) :)

David 大卫

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM