ParallelGraphics Forums
Cortona VRML Client
You are here: [Forums]::[Browsers]::[Cortona VRML Client]

Registration 
Registration
Forgot your password?

Help 
Help
Support

Quick search 

Subscribe to newsletters 

Install Cortona VRML Client for FREE!
Outline 3D
3D Page Of the Week
email:  password:
   Browsers - Cortona VRML Client

Subject: Re: fixed / rotating origin
Sender: dan.vera@gmail.com 18.06.09 02:32

Hi m a r c o ,

Thanks a lot for the reply (and the solution) and sorry for the late answer.

Few additional things I found out:
- if you use a direct routing the origin effectively rotate opposite to the object in the scene, so you have to change the sign of the rotation angle (cf code)
- if you place the origin in a corner of the screen then the center of rotation changes, the scene is a bit awkward to navigate. by using the navigationinfo node, the center of rotation can be reset to 0 0 0 (or else).

DEF my_NavigationInfo NavigationInfo {
speed 0.5
type ["EXAMINE"]
avatarSize [0.25, 1.6, 0.75, 0, 0, 0, -1]
}


DEF    Prox ProximitySensor {size 100 100 100}
DEF    base0 Transform    {
    center 0 0 0
    rotation 0 0 1 0
    children [
     DEF    base1 Transform {
        center 0 0 0
        rotation 0 0 1 0
        translation    -0.5 -0.3 -1
        children [
        Shape {
        geometry Box {size 0.1 0.1 0.001}
        appearance Appearance {
        material Material {diffuseColor 1 0 0}
        }
     }
     ]
    }
    DEF my_scr Script {    
        field    SFNode    base0    USE    base0    
        field    SFNode    base1    USE    base1    
        field    SFNode    Prox    USE    Prox    
        eventIn    SFVec3f    in_pos
        eventIn    SFRotation in_rot
        
        directOutput TRUE
        url "javascript:

        function in_pos (val) {
        }

        function in_rot (val) {
        base1.rotation = new SFRotation(val.x, val.y, val.z, -val.angle);
        }
     "}    
    ]
}

DEF    base Transform    {
    children [
        Shape {
        geometry Box {size 1 1 1}
        appearance Appearance {
        material Material {diffuseColor 1 1 0}
        }
     }
    ]
}

ROUTE    Prox.position_changed TO base0.translation
ROUTE    Prox.orientation_changed TO base0.rotation
ROUTE    Prox.orientation_changed TO my_scr.in_rot


Hello, The idea was good, you now just have to add a rotation to the my_pnl sub element : following code modifies yours to draw the rotating 3d axis as you want.
Regards,
m a r c o
    
DEF PROXSENSOR ProximitySensor {size 1e8 1e8 1e8}
DEF my_tra Transform {
    children [
    DEF my_pnl Transform {
        translation 0 -1 -6.2
        children [
            DEF xaxis Shape {
                appearance Appearance {
                material Material {
                diffuseColor    1 0 0
                }
                }
                 geometry Box {
                 size 1.0 0.02 0.02
                 }
             }
            DEF yaxis Shape {
                appearance Appearance {
                material Material {
                diffuseColor    0 1 0
                }
                }
                 geometry Box {
                 size 0.02 1.0 0.02
                 }
             }
            DEF zaxis Shape {
                appearance Appearance {
                material Material {
                diffuseColor    0 0 1
                }
                }
                 geometry Box {
                 size 0.02 0.02 1.0
                 }
             }
         ]
    }
    ]
}
ROUTE PROXSENSOR.position_changed TO my_tra.translation
ROUTE PROXSENSOR.orientation_changed TO my_tra.rotation
ROUTE PROXSENSOR.orientation_changed TO my_pnl.rotation

Hello All,
I am trying to display a geometry (a xyz coordinate in my case) that would sit in a corner of the screen area, but that would rotate with the scene ... the same as the reference coordinate in some CAD software.

I have managed to make a fixed "user panel" using the following code, but I cannot make it rotate and stay at the same place:

#VRML V2.0 utf8
DEF PROXSENSOR ProximitySensor {size 1e8 1e8 1e8}
DEF my_tra Transform {
    children [
    DEF my_pnl Transform {
    translation 0 -1 -6.2
     children [
        DEF my_geo Shape {
         geometry Box {
         size 0.2 0.5 0.1
         }
     }
     ]
    }
    ]
}
ROUTE PROXSENSOR.position_changed TO my_tra.translation
ROUTE PROXSENSOR.orientation_changed TO my_tra.rotation

If anyone has a idea/solution, i'd appreciate.

thkx


 


fixed / rotating origin / dan.vera@gmail.com / 4.06.09 16:25
     Re: fixed / rotating origin / zlonka@gmail.com / 15.06.09 20:49
         Re: fixed / rotating origin / dan.vera@gmail.com / 18.06.09 02:32

Messages in thread: 3


© 1998-2009 ParallelGraphics. All rights reserved. Terms of use.