Demo link
Video 👉 👉 https://www.youtube.com/watch?v=y7DYMudcT2c&feature=youtu.be 👈 👈
🔑 Language: a-frame➕ three.js ➕ JavaScript
🔑 add models using
<a-assets>
<a-asset-item id="id" src="src/src/scene.gltf"></a-asset-item>
</a-assets>
<a-entity gltf-model="a_entity/model/scene.gltf" position="0 0 0" rotation="0 0 0" scale="0 0 0"></a-entity>
<script>
AFRAME.registerComponent('sun-position-setter', {
init: function () {
var skyEl = this.el;
var orbitEl = this.el.sceneEl.querySelector('#orbit');
orbitEl.addEventListener('componentchanged', function changeSun (evt) {
var sunPosition;
var phi;
var theta;
if (evt.detail.name !== 'rotation') { return; }
sunPosition = orbitEl.getAttribute('rotation');
if(sunPosition === null) { return; }
theta = Math.PI * (- 0.5);
phi = 2 * Math.PI * (sunPosition.y / 360 - 0.5);
//Debugging position
//console.log(Math.cos(phi), Math.sin(phi) * Math.sin(theta))
skyEl.setAttribute('material', 'sunPosition', {
x: Math.cos(phi),
y: Math.sin(phi) * Math.sin(theta),
z: -1
});
});
}
});
</script>
⚡ after clicking the ball can move
<a-animation attribute="position" from="10.636 1.063 -12.74" to="10.636 5.609 -12.74" dur="2000" direction="alternate" repeat="indefinite" begin="click" ></a-animation>
use begin="click"
and it will interact with cursor
Reference
⚡ switch the light
use javascript to change the color from grey to white.
<script>
function setLight(){
var light = document.querySelector('#main-light');
var current_color = light.getAttribute('color');
if (current_color == 'grey'){
light.setAttribute('color', 'white');
}
else{
light.setAttribute('color', 'grey');
}
}
</script>
⚡ trigged dog's sound
<a-entity gltf-model="#dog" position="-8.06 -0.09 11.41" rotation="0 180 0" scale="0.02 0.02 0.02"></a-entity>
<a-box material="color:tomato;transparent:true;opacity:0" depth="2" height="2" width="2" sound="src: url(images/dog_sound.mp3); on: click" class="intersectable" position="-8.06 -0.117 11.41"></a-box>
⚡ background music
Reference
For a C, you need to:
Customize the TTU Computer Science VR showroom into your dream house with your own style of floor and ceilingHave at least unique 10 models at appropriate locationsHave appropriate lighting. Do not give me a dark screen.
For a B, you need to:
Add an additional 5 unique modelsGive the user control over the lightingYou should be able to navigate around the space
For a A, you need to:
Interact with certain objects: Click to trigger a sound track or a song, or Add one dynamic object (moving model, such as a dog or an avatar)
1️⃣ house plate
2️⃣ dog https://sketchfab.com/models/dadb71216dbc4dcfbdd8baee9bdf3ce00
dog sound: https://www.zapsplat.com/sound-effect-category/dogs/
1️⃣ TV
2️⃣ TV cabinet
3️⃣ kitchen cabinet
4️⃣ counter top
5️⃣ table
6️⃣ swith
7️⃣ sofa
8️⃣ coffee table https://sketchfab.com/models/475cfd550f3648178efdf98152a4bc390
9️⃣ chair https://sketchfab.com/models/d2785b57e7da45858f2fe8bf4dedd68d
1️⃣ 0️⃣ tv remote https://sketchfab.com/models/67a5956349574fac8431b9b12aad8b81
1️⃣ 1️⃣ bottle https://sketchfab.com/models/833ef9cea519454fb1d249154b830f04
backgorund music: http://freemusicarchive.org/music/Kevin_MacLeod/Classical_Sampler/Canon_in_D_Major
1️⃣ bed https://sketchfab.com/models/86d5c8b1addf4f138d8f0c2cf06e9ba0
1️⃣ swimming pool
2️⃣ basketball
3️⃣ swing https://sketchfab.com/models/da0fe69537504073badaa3c44db50030
4️⃣ umbrella https://sketchfab.com/models/e0c0ad33836d488da98ba8c4f807b1fe
5️⃣ basketball hoop https://sketchfab.com/models/b882a4fd9e554e76924f55eac40d69c8