work in progress [might break]
This commit is contained in:
parent
e1e3d32c60
commit
d474cb5e8d
5 changed files with 174 additions and 205 deletions
|
|
@ -32,6 +32,7 @@
|
||||||
|
|
||||||
<a-scene light="defaultLightsEnabled: false">
|
<a-scene light="defaultLightsEnabled: false">
|
||||||
<a-entity id="player">
|
<a-entity id="player">
|
||||||
|
<a-entity camera="fov:90" wasd-controls look-controls position="0 1.6 0" id="camera"></a-entity>
|
||||||
<a-entity id="left-hand" laser-controls="hand: left" raycaster="objects:.ray" blink-controls="cameraRig:#player; teleportOrigin: #camera; collisionEntities: #floor">
|
<a-entity id="left-hand" laser-controls="hand: left" raycaster="objects:.ray" blink-controls="cameraRig:#player; teleportOrigin: #camera; collisionEntities: #floor">
|
||||||
<a-entity rotation="-90 0 0" position="0 0.1 0" id="navigator">
|
<a-entity rotation="-90 0 0" position="0 0.1 0" id="navigator">
|
||||||
<a-entity id="back" xrf-button="label: <; width:0.05; action: history.back()" position="-0.025 0 0" class="ray"></a-entity>
|
<a-entity id="back" xrf-button="label: <; width:0.05; action: history.back()" position="-0.025 0 0" class="ray"></a-entity>
|
||||||
|
|
@ -39,7 +40,6 @@
|
||||||
</a-entity>
|
</a-entity>
|
||||||
</a-entity>
|
</a-entity>
|
||||||
<a-entity id="right-hand" laser-controls="hand: right" raycaster="objects:.ray" blink-controls="cameraRig:#player; teleportOrigin: #camera; collisionEntities: #floor"></a-entity>
|
<a-entity id="right-hand" laser-controls="hand: right" raycaster="objects:.ray" blink-controls="cameraRig:#player; teleportOrigin: #camera; collisionEntities: #floor"></a-entity>
|
||||||
<a-entity camera="fov:90" wasd-controls look-controls position="0 1.6 0" id="camera"></a-entity>
|
|
||||||
</a-entity>
|
</a-entity>
|
||||||
|
|
||||||
<a-entity id="home" xrf="index.gltf#pos=0,0,0"></a-entity>
|
<a-entity id="home" xrf="index.gltf#pos=0,0,0"></a-entity>
|
||||||
|
|
@ -48,18 +48,20 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
window.$ = (s) => document.querySelector(s)
|
window.$ = (s) => document.querySelector(s)
|
||||||
|
if( document.location.search.length > 2 )
|
||||||
|
$('#home').setAttribute('xrf', document.location.search.substr(1)+document.location.hash )
|
||||||
|
|
||||||
|
|
||||||
|
$('a-scene').addEventListener('XRF', () => {
|
||||||
|
window.notify = notify(window)
|
||||||
|
window.embed = embed
|
||||||
|
window.notify('loading '+document.location.search.substr(1))
|
||||||
|
|
||||||
console.log = ( (log) => function(str){
|
console.log = ( (log) => function(str){
|
||||||
if( String(str).match(/:.*#/) ) window.notify(str)
|
if( String(str).match(/:.*#/) ) window.notify(str)
|
||||||
log(str)
|
log(str)
|
||||||
})(console.log)
|
})(console.log)
|
||||||
|
|
||||||
if( document.location.search.length > 2 )
|
|
||||||
$('#home').setAttribute('xrf', document.location.search.substr(1)+document.location.hash )
|
|
||||||
|
|
||||||
$('a-scene').addEventListener('XRF', () => {
|
|
||||||
window.notify = notify(window)
|
|
||||||
window.embed = embed
|
|
||||||
|
|
||||||
|
|
||||||
let XRF = window.AFRAME.XRF
|
let XRF = window.AFRAME.XRF
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -54,8 +54,12 @@ window.AFRAME.registerComponent('xrf', {
|
||||||
els.map( (el) => document.querySelector('a-scene').removeChild(el) )
|
els.map( (el) => document.querySelector('a-scene').removeChild(el) )
|
||||||
})
|
})
|
||||||
|
|
||||||
|
aScene.addEventListener('enter-vr', () => {
|
||||||
// undo lookup-control shenanigans (which blocks updating camerarig position in VR)
|
// undo lookup-control shenanigans (which blocks updating camerarig position in VR)
|
||||||
aScene.addEventListener('enter-vr', () => document.querySelector('[camera]').object3D.parent.matrixAutoUpdate = true )
|
document.querySelector('[camera]').object3D.parent.matrixAutoUpdate = true
|
||||||
|
document.querySelector('[camera]').removeAttribute("look-controls")
|
||||||
|
document.querySelector('[camera]').removeAttribute("wasd-controls")
|
||||||
|
})
|
||||||
|
|
||||||
AFRAME.XRF.navigator.to(this.data)
|
AFRAME.XRF.navigator.to(this.data)
|
||||||
.then( (model) => {
|
.then( (model) => {
|
||||||
|
|
|
||||||
|
|
@ -29,8 +29,8 @@ let loadAudio = (mimetype) => function(url,opts){
|
||||||
sound.setVolume(1.0);
|
sound.setVolume(1.0);
|
||||||
if( isPositionalAudio ){
|
if( isPositionalAudio ){
|
||||||
sound.setRefDistance( mesh.scale.x);
|
sound.setRefDistance( mesh.scale.x);
|
||||||
sound.setRolloffFactor(5.0)
|
sound.setRolloffFactor(50.0)
|
||||||
sound.setDirectionalCone( 360, 360, 1 );
|
sound.setDirectionalCone( 360, 360, 0.01 );
|
||||||
}
|
}
|
||||||
|
|
||||||
sound.playXRF = (t) => {
|
sound.playXRF = (t) => {
|
||||||
|
|
|
||||||
|
|
@ -42,13 +42,18 @@ xrf.frag.t.setupMixer = function(opts){
|
||||||
mixer.initClips = () => {
|
mixer.initClips = () => {
|
||||||
if( mixer.clipsInited ) return // fire only once
|
if( mixer.clipsInited ) return // fire only once
|
||||||
model.animations.map( (anim) => {
|
model.animations.map( (anim) => {
|
||||||
let zombies = anim.tracks.map( (t) => !model.scene.getObjectByName(t.name) ? {anim:anim.name,obj:t.name} : undefined )
|
let zombies = anim.tracks.map( (t) => {
|
||||||
|
let name = t.name.replace(/\..*/,'')
|
||||||
|
return !model.scene.getObjectByName(name) ? {anim:anim.name,obj:t.name} : undefined
|
||||||
|
})
|
||||||
if( !anim.action ){
|
if( !anim.action ){
|
||||||
anim.action = mixer.clipAction( anim )
|
anim.action = mixer.clipAction( anim )
|
||||||
anim.action.setLoop(THREE.LoopOnce)
|
anim.action.setLoop(THREE.LoopOnce)
|
||||||
}
|
}
|
||||||
if( zombies.length > 0 ){
|
if( zombies.length > 0 ){
|
||||||
zombies.map( (z) => console.warn(`gltf: object '${z.obj}' not found (anim: '${z.anim}'`) )
|
zombies
|
||||||
|
.filter( (z) => z ) // filter out undefined
|
||||||
|
.map( (z) => console.warn(`gltf: object '${z.obj}' not found (anim: '${z.anim}'`) )
|
||||||
console.warn(`TIP: remove dots in objectnames in blender (which adds dots when duplicating)`)
|
console.warn(`TIP: remove dots in objectnames in blender (which adds dots when duplicating)`)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue