JanusVR Documentation

[BUILD] Javascript: Intro

JanusVR's Javascript engine allows developers to add a layer of depth and creativity to their websites. Users have created experiences ranging from games and demonstrations to educational experiences and collaborative experiences. This guide will help you get up to date with Janus' current capabilities.

Understanding the js_id Attribute

Attaching this attribute to any object will allow it to be easily identified and retrieved within the room's Javascript. If you do not manually set this to something, it will default to a unique number. The js_id of an object cannot conflict with another object.

Understanding the AssetScript Element

Placing an AssetScript within the section of the JanusVR Markup Language will allow you to reference a javascript file.

Understanding the onclick Attribute

Specifies the name of a script or function to run when an object is clicked. If you reference a function, the function should not take any arguments.

Understanding the oncollision Attribute

Specifies the name of a script or function to run when an object is collided with. If you reference a function, the function should take two arguments, the first being the object containing the oncollision attribute, and the second being the object it is colliding with.

The Javascript Debugger

The Javascript Debugger can be brought up manually by inserting the "debugger;" command into your javascript. You can learn more about it on this page.

Before You Begin...

Multiple scripts may be loaded into a room. JanusVR's Javascript language is essentially qtScript, which is equivalent to ECMAScript 3. Please see this website for a reference of what is built in.

The "room" Object


The "room" Object allows developers to change or observe aspects of the webspace, ranging from contents to environmental factors like gravity. It also comes equipped with useful callbacks for developers to take advantage of.

Learn More

Script Objects


Script Objects are essentially the contents of any given webspace. Any room content may be marked with a "js_id" attribute that will allow it to be referenced and altered in the Javascript.

Learn More

The "player" Object


The "player" Object allows the developer to change or observe aspects of the player whilst they are in their webspace.

Learn More