#VRML V2.0 utf8 # Copyright (c) 1997 by blaxxun interactive Inc. # The right to download, change and reuse this example is explicitly # granted, provided proper credit is given. # # The proto that allows to use avatars from the Avatar Den in blaxxun # communities with blaxxun CCpro. The walk animation and gestures are enabled. # # # http://tecfa.unige.ch/vrml/objects/avatars/blaxxun/proto-templ.text # # It is a copy taken from http://www.blaxxun.com/vrml/avatarden/ # Daniel.Schneider@tecfa.unige.ch 2/98 PROTO Avatar [ exposedField SFTime gesture1 0 exposedField SFTime gesture2 0 exposedField SFTime gesture3 0 exposedField SFTime gesture4 0 exposedField SFTime gesture5 0 exposedField SFTime gesture6 0 exposedField SFTime gesture7 0 exposedField SFTime gesture8 0 exposedField SFBool isAvatar TRUE exposedField SFRotation rotation 0 1 0 0 exposedField SFInt32 whichChoice 0 exposedField SFBool isOver FALSE exposedField SFTime touchTime 0 eventIn SFVec3f set_position ] { Switch { whichChoice IS whichChoice choice [ DEF WalkingAvatar Transform { rotation IS rotation children [ # The real avatar starts here # Transform { translation 0 -1.6 0 children [ # The joint model of the avatar goes here Transform { ... } ] } DEF WalkingAvatarTrans PositionInterpolator { key [ 0 1 ] keyValue [0 0 0, 0 0 0] } DEF WalkingAvatarMove Script { eventIn SFVec3f set_position IS set_position field SFVec3f lastPos 0 0 0 field SFVec3f curPos 0 0 0 field MFVec3f keyValues[] field SFNode WalkingAvatarTrans USE WalkingAvatarTrans eventIn SFFloat set_fraction field SFFloat curFraction 0 eventOut SFVec3f startPos eventOut SFVec3f endPos eventOut SFTime startTime eventOut SFTime stopTime url "vrmlscript: function set_fraction (value, timestamp) { fraction = value; } function set_position (value, timestamp) { curPos[0] = lastPos[0] + fraction * (value[0] - lastPos[0]); curPos[1] = lastPos[1] + fraction * (value[1] - lastPos[1]); curPos[2] = lastPos[2] + fraction * (value[2] - lastPos[2]); startPos = curPos; endPos = value; keyValues[0] = lastPos; keyValues[1] = value; WalkingAvatarTrans.set_keyValue = keyValues; lastPos = endPos; startTime = timestamp; stopTime = timestamp + 1.2; } " } ] } ] } # time sensors for the gestures # DEF TimeMove TimeSensor { enabled TRUE cycleInterval 1 } DEF TimeStop TimeSensor { cycleInterval 1 startTime 0 stopTime 0 } DEF TimeWalk TimeSensor { cycleInterval 1 startTime 0 } DEF Time_1 TimeSensor { cycleInterval 4 startTime IS gesture1 } DEF Time_2 TimeSensor { cycleInterval 4 startTime IS gesture2 } DEF Time_3 TimeSensor { cycleInterval 4 startTime IS gesture3 } DEF Time_4 TimeSensor { cycleInterval 4 startTime IS gesture4 } DEF Time_5 TimeSensor { cycleInterval 4 startTime IS gesture5 } DEF Time_6 TimeSensor { cycleInterval 4 startTime IS gesture6 } DEF Time_7 TimeSensor { cycleInterval 4 startTime IS gesture7 } DEF Time_8 TimeSensor { cycleInterval 4 startTime IS gesture8 } ROUTE TimeMove.fraction_changed TO WalkingAvatarTrans.set_fraction ROUTE TimeMove.fraction_changed TO WalkingAvatarMove.set_fraction ROUTE WalkingAvatarMove.startTime TO TimeMove.startTime ROUTE WalkingAvatarMove.startTime TO TimeWalk.startTime ROUTE WalkingAvatarMove.stopTime TO TimeStop.startTime ROUTE WalkingAvatarTrans.value_changed TO WalkingAvatar.set_translation } Avatar { }