[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[x3d-public] RE: [www-vrml] Walking Kamala



Dave A. asks:

>Define 'inline opaqueness'?

Ok.

Inlines:  getting events to an inlined object/world in the containing world
and from one.  VRML97 doesn't allow that (because naming conflicts as I
recall make composition harder to manage, cascades, etc.).

Admittedly, I am not expert but this is what I am doing.  It might help if I
elaborate some composition theory with some running code primitive as it is.

Here are some definitions and some code samples.  I'm open to suggestions
for improving the code, but the definitions are there to provide a
higher-level description of how a non-tech (say English/History/Lit major)
or storyteller might describe this, and how tools might be structured to
enable higher level composition toolkits.

Somewhere there could be a whole chapter on the topic of gesture chaining in
scripts to create 

'acts:  composite gestures sequenced in a script'.  

A reactive character (as I define it, an autonomous avatar as opposed to one
controlled by a user), has a repertoire of acts.  In some cases, an act only
occurs once, but it might be repeated.  The two requirements are that there
be event interfaces that can receive a message (an SFString from a script)
or a standard event such as a proximity SFTime, an isActive SFBool,
whatever, and a script function(s) that sequences the act.  

BTW: the 'intensions' of a reactive character which compose a 'personality'
can be named as a set of tuples of (source, message, act).  The aggregate
intensions of all active characters in an affective proximity compose the
'situation' which play out in some time-proscribed scene/scenario. We don't
need to get into that now, but for the RDFgeeks among us, it's something to
think about. 

Doing the basics: 

A avatar is initially situated in a world:

      DEF Kamala Transform {
	
         translation 277.5 7.8 -74 rotation 0 1 0 1.57 scale 3 3 3 children
[
	    DEF WalkHer TouchSensor {}
            Inline {
               url "kamala.wrl"
            }
         ]
      }

Event sensors (eg, proximity, touch) embedded in an avatar (kamala4.wrl)
initiate the gestures typically by turning time sensors for those gestures
on or off.  Typically these are routed through scripts to chain gestures to
create an 'act'.   A user with the main world open can initiate those
sensors, but the sensor is located in the kamala.wrl.  That is a limit
unless one routes SFStrings as messageTypes (an obvious extensibility
technique because it is relatively straightforward to build a dispatching
script inside the avatar).

    DEF AvatarProx ProximitySensor { size 3 1 3 }

In the basic scenario, we have the character, Kamala, currently located on
the bridge of the scene, ROL.  For this scene, we only have her and the
user.  The user approaches her on the bridge.  The Prox fires and sends an
enterTime (SFTime) event to a script.  For now, we aren't collecting any
history so we only have the one act.  She will wave off the user, then turn
and walk to the Temple of Saraswati and 'wait' there.

I assume in this mail that all of the readers understand the basic VRML
engines.  Avatar Studio creates a single mesh character that has a defined
set of gestures (12 from 0 to 11 in the product, but you can cut and paste
more).  Without getting into the details, each gesture can be said to be
represented by the time sensor that starts and stops it: say ts1, ts2, etc.


A script for an 'act' includes these via an array of USE statements.
Depending on how one structures the code, one might include all available
acts as functions, and all gestures in a single MFNode array, then call the
acts via different eventIns.   Because AFAICT, an avatar of this kind can
only do one gesture at a time, and because the goal is to compose acts of
atomic gestures, scripts are needed to chain these into a linear sequence.
(Similar to monophonic sequencing for the soundGeeks among us).  A Time
event is required to start an act so a timer is provided:

DEF actStart TimeSensor {cycleInterval 1 startTime -1}

The field values are obvious.  This is a monotonic event started only if it
receives an SFTime, in this case, the entertime of Kamala's prox, a device
to simulate for the avatar, personal space.  (SociologistGeeks among us know
this varies by culture.)

The route, ROUTE AvatarProx.enterTime TO doAct.actWalkFromBridge

initiates the act.  For now, she only can do one, but extensions here are
obvious.

DEF doAct Script {                    
      
  eventIn SFTime actWalkFromBridge

  # Get all gestures for creating acts
  field MFNode tsGesture[USE TS0,USE TS1,USE TS2,USE TS3,USE TS4,
  USE TS5,USE TS6,USE TS7,USE TS8,USE TS9,USE TS10,USE TS11, USE TS12, 
  USE TS13]

  # A view is bound here just for building purposes (to find her if she
  # decides to go to badoondoon).
  field SFNode kamView USE KamalaView

  directOutput TRUE   

 url "javascript: 

                // entertime function for one act.  
                
      function actWalkFromBridge (value) {       
        var inc = tsGesture[5].cycleInterval + 0.5;
        // wave off user.
        tsGesture[5].startTime = value;
        
	if (tsGesture[5].enabled == TRUE){
              # Turn away     
              tsGesture[12].startTime = value + inc; 
              inc = tsGesture[12].cycleInterval + 3.5;
              # start walk cycling
              tsGesture[11].loop = TRUE;
              tsGesture[11].startTime = value + inc;
              kamView.set_bind = TRUE;
              # translate to Temple
	        tsGesture[13].startTime = value + 5;
              # stop walk cycling
        //THIS DOESN'T WORK.  
        //if (Browser.getTime() > (value + 60)){tsGesture[11].loop = FALSE;}
              
              
	}
	
      }

"
}

This approach can be improved with PROTOs, I'm sure but I'm not there yet.
Happy for any help because this lets us create 'personalities' in a
consistent way that can be taught to non-VRML/X3D geeks (such as trainers,
sociologists, authors of entertainment and so on).

len



-------------------------------------------------------------------------
for list subscription/unsubscription,
go to http://www.web3d.org/cgi-bin/public_list_signup/lwgate/listsavail.html