Created
November 19, 2017 07:49
-
-
Save nitin42/54030fc0d05dea9656fbab3db7bb7e05 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
////////////////////////////////////////////////////////////////////////////// | |
// arjs-hit-testing | |
////////////////////////////////////////////////////////////////////////////// | |
AFRAME.registerComponent('arjs-portal-door', { | |
schema: { | |
url : { // Url of the content - may be video or image | |
type: 'string', | |
}, | |
doorWidth : { // width of the door | |
type: 'number', | |
default: 1, | |
}, | |
doorHeight : { // height of the door | |
type: 'number', | |
default: 2, | |
}, | |
}, | |
init: function () { | |
var _this = this | |
var doorWidth = this.data.doorWidth | |
var doorHeight = this.data.doorHeight | |
var imageURL = this.data.url | |
var portalDoor = new THREEx.Portal360(imageURL, doorWidth, doorHeight) | |
this._portalDoor = portalDoor | |
this.el.object3D.add(portalDoor.object3d) | |
}, | |
tick: function(){ | |
this._portalDoor.update() | |
} | |
}) | |
AFRAME.registerPrimitive('a-portal-door', AFRAME.utils.extendDeep({}, AFRAME.primitives.getMeshMixin(), { | |
defaultComponents: { | |
'arjs-portal-door': {}, | |
}, | |
mappings: { | |
'url': 'arjs-portal-door.url', | |
} | |
})) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment