Importing models

Although it's possible to make nice scenes with spheres and cubes, most of the rooms you will create will involve objects created in 3D modelling programs. These can be imported with a simple statement. 

<import id="chair" src="chair.dae" rx="270deg"></import>

This presumes you have a DAE file sitting on your web server with the object you need. Here is one that I used for this example:

I needed to rename the file and include the texture for it to work.

Here is the complete code. Notice the y value on the group - this is to simulate the user standing over the chair:

    <meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
    <script src="glam.min.js" ></script>
<div id="container" style="width: 100%; height: 100%; position: absolute;">
            <renderer type="cardboard"></renderer>
            <controller type="deviceOrientation"></controller>
            <group z="-3" y="-2">
                <import id="chair" src="chair.dae" rx="270deg"></import>

No comments:

Post a Comment