Skip to content

Instantly share code, notes, and snippets.

@sirkitree
Created November 19, 2014 05:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sirkitree/908ed1309d6c88909539 to your computer and use it in GitHub Desktop.
Save sirkitree/908ed1309d6c88909539 to your computer and use it in GitHub Desktop.
Change websurface_id in Janus VR
<html>
<head>
<title>Lullabot loves you!</title>
</head>
<body>
This is an example of using the AssetWebSurface tag in Janus VR to insert a website as a texture on an object.
<FireBoxRoom>
<Assets>
<AssetObject id="plane" src="plane.obj" />
<AssetWebSurface id="lullabot" src="https://www.lullabot.com" width="1920" height="1080" />
<AssetWebSurface id="google" src="https://www.google.com" width="1920" height="1080" />
<AssetScript src="script.js" />
</Assets>
<Room use_local_asset="room_plane" col="1.000 0.500 0.500">
<Object id="plane" js_id="487" websurface_id="lullabot" pos="1 1 1" xdir="1.000 0.000 0.000" ydir="0.000 0.000 1.000" zdir="0.000 -1.000 0.000" scale="20.300 4.900 12.100" />
</Room>
</FireBoxRoom>
</body>
</html>
room.onLoad = function () {
room.createObject('Text', {
js_id : 'text_text',
text : 'text_text',
pos : Vector(3, 3, 3),
fwd : scalarMultiply(player.view_dir, -1)
});
}
room.onKeyDown = function (event) {
room.objects["text_text"].text = "event.keyCode? : " + event.keyCode;
if (event.keyCode == "x" || event.keyCode == "X") {
// testing to see if we can manipulate the AssetWebSurface object
room.objects["plane"].websurface_id = "google";
}
key_depressed = 1;
}
room.onKeyUp = function (keyCode) {
key_depressed = 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment