FINAL EXERCICE: A REAL SGAG EXTERNAL

Now that you know how a little about the Blink3D Buoider and Blender, let's go to a challenge: create an "SGAG external object" (totaly useless, only an exercice) that is: two cubes (200x200x200), one over the other, at the positional point at the center of the base of the inferior and having, like texture, an arrow in the superior face of each cube, pointing to North.

Lets go,step by step :

1 to 9 - Follow the steps 1 to 9 of this lesson, creating a project Exerc2.

9a - Add the first Cube. Change its name to "firstcube". Re-read the previous lessons to know how to create the UV map and find what is the superior face.

9b - Design and install of the texture.

9c - Create the "secondcube" and its texture.

9d - Delete the Ground and, on Object mode, Join the two cubes , creating a new name in the Buttons Window: "cubes").

10 to 15 - Follow the steps 10 to 15 of this lesson and this lesson but changing the name of the file .material

Open the files cubes.material and cubes.mesh.xml to see if there are the two submeshes and only the two materials. If something is wrong, erase the files, do the Joins again and Export. Errors doing the Join are usual...

You need to move all the two .TGA files to the "Script" folder. Don't forget the PostWorld.js. But here we have an important thing to do:

An SGAG external object needs three parameters defined:

Open the file PostWorld.js and replace all the lines by:

cubesEntity = Scene.createEntity( "cubes","cubes.mesh" );
cubesNode = Scene.createSceneNode( "cubesNode" );
cubesNode.attachObject(cubesEntity );
cubesNode.translate(Vector(0,0,0 ),cubesNode.TRANSFORM_WORLD );
cubesEntity.fixed = false;
cubesEntity.kinematic = true;  
cubesEntity.collisionGeometryType=cubesEntity.COLLISION_GEOM_TRI_SOUP; 
cubesEntity.createPhysicalModel();

When the name of your SGAG external object is not "cubes" do the equivalent.

Important to anotate that we have here our first parameter defined: ENTITYNAME. It's: "cubes".

At the step 15, reopening the Blink3D Builder, you need to see the two cubes. Move the camera until find them:

Let's go to the final steps for the creation of our first "SGAG external object/block".

16 - You need to "Publish" the object. At the first window of the Publishing Wizard click "Extention" and for "Resource group", type: cubes. We have here the value of second parameter: RESOURCEGROUP.

17 - Opening C:\Bbgcourse\Exerc2\Publish you will see the file: Exerc2.envx. You can change this name to: cubes.envx. Upload this file to your site. We did it and its address (this is "real") is:

http://www.dmu.com/bl/cubes.envx

here we have the last paramater:ENVXADDRESS!

The new SGAG object is available to be "installed" at any SGAG environment using the "formula":

external(\'ENVXADDRESS\',\'RESOURCEGROUP\',\'ENTITYNAME\',posx,posy,posz,roty)

So: we can do an exercice having, by example:

////////////////////////////////////////////////
////AREA FOR INSTALLERS & CONSTRUCTORS & WIZARDS
////////////////////////////////////////////////
'DEFAULTGALLERY="no";'+
//Change to "no" if you are defining your gallery
'GRID="yes";'+
////////////////OBJECTS HERE:
 
'BLOCK1="external(\'http://www.dmu.com/bl/cubes.envx\',\'cubes\',\'cubes\',-1000,0,-700,0)";'+
 


///////////////////////////////////////////////////
////////END OF SGAG SCRIPT AREA
//////////////////////////////////////////////////

Look it running here.

VERY IMPORTANT: We can only install ONE copy of an SGAG External Object at each Gallery. You can have, of course, many "clones" of it, having different parameters.


PREVIOUS LESSON
T.CONTENTS HOMEPAGE