| Prezes 2006-02-07, 11:41 pm |
| Hello all VRML funs!
Problem with rotation.
There is a world that I've built. I want to rotate all 3 Box'es with my
scroll at about 90 degrees (+/-) at the same time (no problem;) ). I
give you the source code of my project. The scroll controls only Box01
sofar. I want to do the same rotation with Box02 and 03. When I connect
the scroll to the other Boxes it don't work as I want. WHY?
I know there is a problem with axis. hmmm.....any ideas how to realize
this task?
Thanks for help:)
#VRML V2.0 utf8
DEF Kamera01 Viewpoint {
position 2.844 5.01 267.6
orientation 1 0 0 0
fieldOfView 0.6024
description "Kamera01"
}
DEF proxy ProximitySensor {
size 300e10 300e10 300e10
center 0 0 0
}
DEF Box01 Transform {
translation 0.001459 14.58 -0.01354
children [
Transform {
translation 0 22.2 0
children [
Shape {
appearance Appearance {
material Material {
diffuseColor 0.4431 0.5255 0.02353
}
}
geometry Box { size 4 44.4 4 }
}
] }
]
}
DEF Box02 Transform {
translation 12.64 -7.304 -0.01354
rotation 0 0 1 -2.094
children [
Transform {
translation 0 22.2 0
children [
Shape {
appearance Appearance {
material Material {
diffuseColor 0.4431 0.5255 0.02353
}
}
geometry Box { size 4 44.4 4 }
}
] }
]
}
DEF Box03 Transform {
translation -12.61 -7.349 -0.01354
rotation 0 0 1 -4.186
children [
Transform {
translation 0 22.2 0
children [
Shape {
appearance Appearance {
material Material {
diffuseColor 0.4431 0.5255 0.02353
}
}
geometry Box { size 4 44.4 4 }
}
] }
]
}
DEF Sphere01 Transform {
translation 0.1669 0 0
rotation -1 0 0 -1.571
children [
Shape {
appearance Appearance {
material Material {
diffuseColor 0.4235 0.03137 0.5333
}
}
geometry Sphere { radius 17.36 }
}
]
}
DEF HudGroup Collision {
collide FALSE
children [
DEF scroll Transform {
children [
Transform {
translation -0.05 0 -0.2
children [
Shape {
appearance Appearance {
material Material {
diffuseColor 0.6941 0.5804 0.102
}
}
geometry Cylinder { radius 0.001 height 40 }
}
DEF Sphere Transform {
children [
DEF PS PlaneSensor {
maxPosition 0 0.06
minPosition 0 -0.06
}
Shape {
appearance Appearance {
material Material {
diffuseColor .88 .15 .01
specularColor .19 .03 .03
ambientIntensity .0833
shininess .08
}
}
geometry Sphere { radius 0.004 }
}
]}
DEF text Transform {
children [
Transform {
translation -0.04 0.08 -0.1
children [
Shape {
geometry DEF MyText Text {
string "0.0"
fontStyle FontStyle {
size 0.02
}
}
}
]
}
]
ROUTE PS.translation_changed TO Sphere.translation
}
DEF myScript Script {
eventIn SFVec3f pos_regulatora
field SFInt32 a 0
eventOut MFString go
url [
"vrmlscript:
function pos_regulatora(value) {
a=value[1]*1501;
go = new MFString('y='+a);
}
"]}
]
}
DEF pitch_script Script {
eventIn SFVec3f position
field SFFloat alpha 0
eventOut SFRotation pitch
mustEvaluate FALSE
url [
"java script:
function position(value) {
alpha=value[1]*26;
pitch = new SFRotation(0,1,0,alpha);
}
"]
}]
ROUTE PS.translation_changed TO pitch_script.position
ROUTE pitch_script.pitch TO Box01.rotation
ROUTE Sphere.translation TO myScript.pos_regulatora
ROUTE myScript.go TO MyText.string
ROUTE proxy.position_changed TO proxy.center
ROUTE proxy.position_changed TO scroll.translation
ROUTE proxy.orientation_changed TO scroll.rotation
}
]}
|