Giter VIP home page Giter VIP logo

virtual_reality4331's Introduction

CS4331 -Virtual_Reality4331 Project1

Build Your Own House

Demo link ▶️ https://carolynwu.github.io/virtual_reality4331/
Video 👉 👉 https://www.youtube.com/watch?v=y7DYMudcT2c&feature=youtu.be 👈 👈

Features:

🔑 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>

⚡SKY 2018-02-17_21-02-47

  <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
2018-02-17_21-17-07

 <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 ▶️ https://www.youtube.com/watch?v=SyU9dEt7tNs

⚡ switch the light
2018-02-18_14-22-41 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 ▶️ https://github.com/etiennepinchon/aframe-resonance

Grading:

For a C, you need to:

  • Customize the TTU Computer Science VR showroom into your dream house with your own style of floor and ceiling
  • Have at least unique 10 models at appropriate locations
  • Have appropriate lighting. Do not give me a dark screen.

For a B, you need to:

  • Add an additional 5 unique models
  • Give the user control over the lighting
  • You 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)

External Model Sources

in front of the house

1️⃣ house plate
2️⃣ dog  https://sketchfab.com/models/dadb71216dbc4dcfbdd8baee9bdf3ce00 dog sound: https://www.zapsplat.com/sound-effect-category/dogs/ in_front_of_door

living room

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

living room

bedroom

1️⃣ bed https://sketchfab.com/models/86d5c8b1addf4f138d8f0c2cf06e9ba0 bed

outdoor

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 outdoor

virtual_reality4331's People

Contributors

carolynwu avatar

virtual_reality4331's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.