WebGL publishing & communication with JavaScript commands


#1

First of all: i am really impressed by the graphics quallity of Armory3D ! In my opinion, even in a simple scene without SSAO (everything by defaul settings) with simple objects, you can regognize much more details (depth) in the geometry, in comparison to other game Engines (2x big ones). (Just my statement, because its my first post)

Back to Topic.
If i publish my scene to html5, i want to communicate with it by javascript. In my case it is a Javascript based Website, and i want to embed Armory3D html5 in it. So how is this doable ? Do i have to prepare my HAXE-code for that ? Do i need a seperate *.json file for communication ?

A situation could be:
i want to click on my javascript button (website) to hide my “cube” in the scene (armory3D).
I would do a function “hide_this” for that in HAXE. But how can i trigger this function by the outside
Javascript ?
.


#2

Hello @sledge, happy you like Armory! To expose Haxe function to JavaScript, see:

And to call JavaScript from Haxe:

You can create and expose a hide_this() function like you suggest, or expose parts of Armory like in the linked example, which gives you a direct access:

// js
let plugin = new arm.Plugin();
let scene = plugin.scene();
scene.getChild("Cube").visible = false;

#3

Niceee ! Thx for explaining it. I will dig deeper into it. If i got some more questions about it, i hope i can ask again :slight_smile:


#5

Can you create new thread and add more information on what you want, so that we can help you easily.


#7

Hello.

It was just a general question. I didn´t started yet to make a project in HTML5. But as soon as i start, i will make a new thread about this. cheers