JavaScript Framework?


#1

Hi.

Please, is there a specific framework that JavaScript is working on in HiFi?
I have some .js that I wrote for Unity, but they do not work here. Yes, I know that Unity’s JS varies slightly from normal .js, but is there something else that I need to take into account before working with scripts from .js libraries, for example?
(I am a novice .js’er, and a novice HiFi’er!)

Thank you.


#2

The framework that it works on is via the API that the developers have provided.

If you run the script currentAPI.js it will print a list of the code that is exposed for controlling the C++
behind Interface.

Unity has it’s own set of commands for the things it source code supports.
That is why you are unable to run a Unity script in HiFi.


#3

JavaScript in HiFi uses the Qt framework (from what I can see in the source), but that’s not to say the same functions that are present in Unity will be the same in HiFi. JavaScript is just the language interpreter that tells the host application to do stuff, and the host application says to Java "Create ‘something’ as a function for the script to use’.

The lexicon is the same, just the embedded functions will be different…

http://docs.highfidelity.com/ the API section here will be your best reference


#4

You know, @Chris said that @Ozan got a polygon script that was developed for Unity, and used it here to make Polyworld. I guess I need to figure out if they had to adapt something and if so, what. I have so much Unity stuff;–meshes, height maps, some scripts-- sure would be nice to bring a bunch of it in here.


#5

This is quoted from TechCrunch speaking about HiFi:
"For now, the majority of development in the space happens in traditional game engines like Unity and Unreal."
So, I think it must be possible to use all of my stuff here.