This is Interesting: Free Magazines for Graphics designers and webmasters  


Home > Archive > VRML > January 2004 > objact always facing viewpoint





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 objact always facing viewpoint
Robert Ludewig

2004-01-28, 3:30 pm

hello,

howe can I make a Shape to always face the viewpoint and moving with
it. So when I move and look around in the vrmlscene that Shape will
always stays in the lower left corner of the window and is vacing
towards me. I need to make a headsupdisplay and a 3d Button (a
sphere-like shape) that way.
Jeremy Pitten

2004-01-28, 4:31 pm

Have a look at the following :

#VRML V2.0 utf8

PROTO Hud
[
exposedField SFVec3f translation 0 0 0
exposedField SFRotation rotation 0 1 0 0
exposedField SFColor colour 1 0 0
field SFBool show TRUE
eventIn SFBool set_show
eventOut SFTime touched
]
{
Transform {
translation IS translation
rotation IS rotation
children [
DEF SWITCH Switch {
choice [
Transform {
translation 0 0 -0.01
children [
DEF TS TouchSensor {touchTime IS touched }
Transform {
translation -0.028 0.02 -0.05
scale .05 .05 .05
children [
Shape {
appearance Appearance {
material DEF MAT Material {diffuseColor 1 0 0 }
}
geometry Sphere {radius 0.03}
}
]
}
]
}
]
whichChoice 0
}
]
}
DEF HUD_SC Script {
field SFNode mat USE MAT
field SFNode sw USE SWITCH
field SFBool show IS show
eventIn SFBool over
eventIn SFBool set_show IS set_show
url "java script:
function initialize(){ set_show(show); }
function set_show(value)
{
print('HUD : set_show( ' + value + ' )');
if(value){
sw.whichChoice = 0;
} else {
sw.whichChoice = -1;
}
}
function over(value) {
print('HUD : over( ' + value + ' )');
if(value){
mat.set_emissiveColor = new SFColor(0.0, 0.2, 0.2);
} else {
mat.set_emissiveColor = new SFColor(0, 0, 0);
}
}"
}
ROUTE TS.isOver_changed TO HUD_SC.over
}

DEF PROX ProximitySensor {
center 0 0 0
size 100 100 100
}
DEF HUD Hud { }

ROUTE PROX.position_changed TO HUD.set_translation
ROUTE PROX.orientation_changed TO HUD.set_rotation

# end of file
"Robert Ludewig" <schwertfischtrombose@gmx.de> wrote in message
news:683ab5d5.0401281037.2b87ebfa@posting.google.com...
quote:

> hello,
>
> howe can I make a Shape to always face the viewpoint and moving with
> it. So when I move and look around in the vrmlscene that Shape will
> always stays in the lower left corner of the window and is vacing
> towards me. I need to make a headsupdisplay and a 3d Button (a
> sphere-like shape) that way.




Sponsored Links


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