Skip to content

Instantly share code, notes, and snippets.

@nitin42
Created November 19, 2017 07:49
Show Gist options
  • Save nitin42/54030fc0d05dea9656fbab3db7bb7e05 to your computer and use it in GitHub Desktop.
Save nitin42/54030fc0d05dea9656fbab3db7bb7e05 to your computer and use it in GitHub Desktop.
//////////////////////////////////////////////////////////////////////////////
// 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