twocone_1a.wrl source
#VRML V2.0 utf8

Viewpoint {}

NavigationInfo {
type "EXAMINE"
}

# 円錐が配置される場所
DEF Gp Group {}

# スクリプト
DEF Sc Script {
eventOut MFNode children
field SFColor red 1 0 0
field SFVec3f left -2 0 0
field SFVec3f right 2 0 0
url "javascript:

function initialize() {

var coneStr = 'Shape { geometry Cone {} }';
var apprStr = 'Appearance { material Material {} }';
var trnsStr = 'Transform {}';

var coneL = new SFNode ( coneStr );
var coneR = new SFNode ( coneStr );
coneL.geometry.height = 3;

var appr = new SFNode ( apprStr );

appr.material.diffuseColor = red;
coneL.appearance = appr;
coneR.appearance = appr;

var trnsLt = new SFNode ( trnsStr );
var trnsRt = new SFNode ( trnsStr );
trnsLt.translation = left;
trnsRt.translation = right;
trnsLt.children[0] = coneL;
trnsRt.children[0] = coneR;

children[0] = trnsLt;
children[1] = trnsRt;

}

"
}

ROUTE Sc.children TO Gp.children