This is Interesting: Free Magazines for Graphics designers and webmasters  


Home > Archive > VRML > September 2004 > EXTERNPROTO / PROTO question





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author EXTERNPROTO / PROTO question
John Andrews

2004-09-02, 11:15 pm

thanks for recent suggestions on PROTO's & EXTERNPROTO's. I've got a
very simple example file i've written that i just can't get to work,
however. The primary file looks like this:

#VRML V2.0 utf8

DEF PROX ProximitySensor { size 100 100 100 }

EXTERNPROTO Title [
field SFFloat hey
eventIn SFFloat hey_set
] "proto.wrl#Title"

DEF t1 Title { }

DEF buttTR Transform {
children [
Transform {
translation -0.1500 0.0350 -0.2500
children [
Shape {
geometry Box { size 0.0300 0.0070 0.0001}
}
DEF buttTS TouchSensor {}
]
}
]
}

ROUTE PROX.position_changed TO buttTR.set_translation
ROUTE PROX.orientation_changed TO buttTR.set_rotation
ROUTE buttTS.isActive TO t1.hey_set

--------- and the proto file looks like this:

#VRML V2.0 utf8

PROTO Title [

field SFFloat hey 1.0
eventIn SFFloat hey_set

] {

Shape {
appearance Appearance
{
texture ImageTexture { url "title.jpg" }
}
geometry IndexedFaceSet
{
solid FALSE
coord Coordinate
{
point[ -2 2 3, -2 -2 3, 2 -2 3, 2 2 3, ]
}
texCoord TextureCoordinate
{
point [ .001 .999, .001 .001, .499 .001, .499 .999, ]
}
coordIndex [ 0, 1, 2, 3, -1, ]
}
}

DEF tCoord Script
{
field SFFloat hey IS hey
eventIn SFFloat hey_set IS hey_set
url "java script:


// function hey_set()
// {
// hey = 1.0;
// }

"
}
}


i've tried many edited variations of this file and i just can't get it
to open in CosmoWorlds without the flashing yellow lights (or if i
comment the "ROUTE buttTS... line). basically, i want the buttTS
TouchSensor to access functions in the PROTO's Script Node. I've
found similar examples to mine on the web that work, but i can't find
the bug here. suggestions?

Sponsored Links


Copyright 2003 - 2008 forum4designers.com  Software forum  Computer Hardware reviews