Add objects to your avatar

1 post / 0 new
Alain
Alain's picture
Add objects to your avatar
Undefined

Add objects to your avatar

( example from "catwoman" , copyright "planetnana.co.il" )

##########################################
# Add these lines after the main shape   # code#1 begin here
##########################################
DEF center_Obj Transform {
    children [
      #Place your accessory geometry here
    ]
}
#
DEF vl5_Obj Transform {
    children [
     #Place your accessory geometry here
    ]
}
#
DEF vc7_Obj Transform {
    children [
     #Place your accessory geometry here
    ]
}
#
DEF neck_Obj Transform {
    children [
     #Place your accessory geometry here
    ]
}
#
DEF skull_Obj Transform {
    children [
     #Place your accessory geometry here

    ]
}
#

DEF r_wrist_Obj Transform {
    children [
     #Place your accessory geometry here
    ]
}
#
DEF l_wrist_Obj Transform {
    children [
     #Place your accessory geometry here
    ]
}
#
########################################## end code#1

 


*****
after ...............eventIn SFRotation rot_l_knee2
     #################################################
# ADD These lines to the interface of Welder    #  code#2 begin here
#################################################
eventOut SFVec3f pos_Center_changed #
eventOut SFRotation rot_Center_changed #
#
eventOut SFVec3f pos_sacroiliac_changed #
eventOut SFRotation rot_sacroiliac_changed #
#
eventOut SFVec3f pos_vl5_changed #
eventOut SFRotation rot_vl5_changed #
eventOut SFVec3f pos_vc7_changed #
eventOut SFRotation rot_vc7_changed #
eventOut SFVec3f pos_neck_changed #
eventOut SFRotation rot_neck_changed #
eventOut SFVec3f pos_skull_changed #
eventOut SFRotation rot_skull_changed #
#
eventOut SFVec3f pos_r_shoulder_changed #
eventOut SFRotation rot_r_shoulder_changed #
eventOut SFVec3f pos_r_elbow_changed #
eventOut SFRotation rot_r_elbow_changed #
eventOut SFVec3f pos_r_wrist_changed #
eventOut SFRotation rot_r_wrist_changed #
#
eventOut SFVec3f pos_l_shoulder_changed #
eventOut SFRotation rot_l_shoulder_changed #
eventOut SFVec3f pos_l_elbow_changed #
eventOut SFRotation rot_l_elbow_changed #
eventOut SFVec3f pos_l_wrist_changed #
eventOut SFRotation rot_l_wrist_changed #
#
eventOut SFVec3f pos_r_hip_changed #
eventOut SFRotation rot_r_hip_changed #
eventOut SFVec3f pos_r_knee_changed #
eventOut SFRotation rot_r_knee_changed #
eventOut SFVec3f pos_r_ankle_changed #
eventOut SFRotation rot_r_ankle_changed #
#
eventOut SFVec3f pos_l_hip_changed #
eventOut SFRotation rot_l_hip_changed #
eventOut SFVec3f pos_l_knee_changed #
eventOut SFRotation rot_l_knee_changed #
eventOut SFVec3f pos_l_ankle_changed #
eventOut SFRotation rot_l_ankle_changed #
#
eventOut SFVec3f pos_pubis_changed #
eventOut SFRotation rot_pubis_changed #
################################################    code #2 end here
before..................     field SFNode Vtx USE PointList

***********
after ................else if(mode==1)Vtx.point.setByVertexTransform(V,vgroups,P,R);
//#####################################################
 // ADD to end of the Welder function eventsProcessed  #   code #3 begin here
 //#####################################################
   m0=new VrmlMatrix();                                              
   m0.setTransform(P[0],R[0]);

   m1=new VrmlMatrix();
   m1.setTransform(P[1],R[1]);m1=m1.multRight(m0);
   m1.getTransform(pos_Center_changed,rot_Center_changed);

   m2=new VrmlMatrix();
   m2.setTransform(P[2],R[2]);m2=m2.multRight(m1);
   m2.getTransform(pos_sacroiliac_changed,rot_sacroiliac_changed);
 
   m3=new VrmlMatrix();
   m3.setTransform(P[3],R[3]);m3=m3.multRight(m2);
   m3.getTransform(pos_vl5_changed,rot_vl5_changed);

   m4=new VrmlMatrix();
   m4.setTransform(P[4],R[4]);m4=m4.multRight(m3);
   m4.getTransform(pos_vc7_changed,rot_vc7_changed);

   m5=new VrmlMatrix();
   m5.setTransform(P[7],R[7]);m5=m5.multRight(m4);
   m5.getTransform(pos_neck_changed,rot_neck_changed,scale);

   m6=new VrmlMatrix();
   m6.setTransform(P[8],R[8]);m6=m6.multRight(m5);
   m6.getTransform(pos_skull_changed,rot_skull_changed,scale);

   m7=new VrmlMatrix();
   m5.setTransform(P[22],R[22]);m5=m5.multRight(m4);
   m6.setTransform(P[24],R[24]);m6=m6.multRight(m5);
   m7.setTransform(P[25],R[25]);m7=m7.multRight(m6);
   m5.getTransform(pos_r_shoulder_changed,rot_r_shoulder_changed);
   m6.getTransform(pos_r_elbow_changed,rot_r_elbow_changed);
   m7.getTransform(pos_r_wrist_changed,rot_r_wrist_changed);

   m5.setTransform(P[29],R[29]);m5=m5.multRight(m4);
   m6.setTransform(P[31],R[31]);m6=m6.multRight(m5);
   m7.setTransform(P[32],R[32]);m7=m7.multRight(m6);
   m5.getTransform(pos_l_shoulder_changed,rot_l_shoulder_changed);
   m6.getTransform(pos_l_elbow_changed,rot_l_elbow_changed);
   m7.getTransform(pos_l_wrist_changed,rot_l_wrist_changed);

   m3.setTransform(P[36],R[36]);m3=m3.multRight(m2);
   m4.setTransform(P[37],R[37]);m4=m4.multRight(m3);
   m5.setTransform(P[39],R[39]);m5=m5.multRight(m4);
   m6.setTransform(P[40],R[40]);m6=m6.multRight(m5);
   m4.getTransform(pos_r_hip_changed,rot_r_hip_changed);
   m5.getTransform(pos_r_knee_changed,rot_r_knee_changed);
   m6.getTransform(pos_r_ankle_changed,rot_r_ankle_changed);

   m3.setTransform(P[43],R[43]);m3=m3.multRight(m2);
   m4.setTransform(P[44],R[44]);m4=m4.multRight(m3);
   m5.setTransform(P[46],R[46]);m5=m5.multRight(m4);
   m6.setTransform(P[47],R[47]);m6=m6.multRight(m5);
   m4.getTransform(pos_l_hip_changed,rot_l_hip_changed);
   m5.getTransform(pos_l_knee_changed,rot_l_knee_changed);
   m6.getTransform(pos_l_ankle_changed,rot_l_ankle_changed);

 //#####################################################      code#3 end here
 before..........................     }
      function eventsProcessed(){
*************
#################################################################  code#4 begin here
# ADD These lines at the very end of the Avatar PROTO           #
#################################################################
ROUTE Welder.pos_vl5_changed TO vl5_Obj.set_translation
ROUTE Welder.rot_vl5_changed TO vl5_Obj.set_rotation
ROUTE Welder.pos_Center_changed TO center_Obj.set_translation
ROUTE Welder.rot_Center_changed TO center_Obj.set_rotation
ROUTE Welder.pos_vc7_changed TO vc7_Obj.set_translation
ROUTE Welder.rot_vc7_changed TO vc7_Obj.set_rotation
ROUTE Welder.pos_neck_changed TO neck_Obj.set_translation
ROUTE Welder.rot_neck_changed TO neck_Obj.set_rotation
ROUTE Welder.pos_skull_changed TO skull_Obj.set_translation
ROUTE Welder.rot_skull_changed TO skull_Obj.set_rotation
ROUTE Welder.pos_r_wrist_changed TO r_wrist_Obj.set_translation
ROUTE Welder.rot_r_wrist_changed TO r_wrist_Obj.set_rotation
ROUTE Welder.pos_l_wrist_changed TO l_wrist_Obj.set_translation
ROUTE Welder.rot_l_wrist_changed TO l_wrist_Obj.set_rotation
#################################################################    code#4 end here

before ............................}#PROTO Avatar

***************
http://mixed3d.free.fr/babelx3d/catwoman52011.wrl

Another example, adding just hair

 

Visibility: 
Public - accessible to all site users

GTranslate