buildar / awe.js

The jQuery for the Augmented Web
515 stars 113 forks source link

Adding Custom 3d Objects #7

Closed aminubakori closed 9 years ago

aminubakori commented 9 years ago

Hi Guys I have been looking for how to add custom 3d objects to awe.js but haven't found any useful information. Please urgent help is needed on this.

magiraldooc commented 9 years ago

Hello I have been doing some experiments and I used this code for add custom 3D objects, but the object not disappear when the marker is not on tracking like the others 3D objects.

                        awe.projections.add({
                            id: 'projection_1',
                            geometry: {
                                path: 'resources/Lander.obj',
                                x: 120,
                                y: 120,
                                z: 120
                            },
                            scale: { 
                                x: 10,
                                y: 10,
                                z: 10 
                            },
                            position: {
                                x: 150,
                                y: 150,
                                z: 50,
                            },
                            material: {
                                type: 'phong',
                                color: 0xFFFFFF
                            },
                            texture: {
                                path: 'resources/Lander_D.png'
                            },
                        },
                        {
                            poi_id: 'poi_1'
                        });
robman commented 9 years ago

Hi @aminubakori - the example that @magiraldooc has posted should give you what you need.

However, the geometry shouldn't really have the x/y/z keys as this definition is meant to be taken from the .obj file itself.

@magiraldooc see my comment in #8 in response to your question here - please post any comments about that in that issue thread.

r03ert0 commented 8 years ago

Hello, What is this .obj format? I'm using MeshLab to create a mesh in .obj format (the Alias Wavefront Object), but I get a "not well formed" error.

franeipos commented 8 years ago

Hello, i'm trying to add a custom object to my scene, but i doesnt work. I'm following the same steps that @magiraldooc explained on his post...And i'm sure that the problem is loading my object , because if i change it to 'shape:cube' it works perfectly. Any ideas ? Thank you very much!

awe.projections.add({ id: 'star1', geometry: { path: './cube.obj', x: 60, y: 30, z: 5 }, scale: { x: 1, y: 1, z: 1 }, material: { type: 'phong', color: 0x000000 } }, {poi_id: 'marker'});

canonex commented 8 years ago

I receive the same error with custom obj: "not well formed" The obj is standard, created with Blender.