// ygUser.yg // // Interaction within VR worlds requires the presense of a user. // Users must be able to change their position, or transformation, in the VR world. // The ygUser node establishes a user transformation but does little else by itself. // // We can define a user and name it as follows: user User0() // Typical user interaction relies on much more than the establishment of a user. // Nodes added as children of a user augment the interaction capabilities of the user. { // A ygCAVENavigator node establishes a mode of travel within the VR environment. // The mode of travel is a means of updating the transformation of the ygUser node. // All messages sent to the ygUser node are passed directly to any ygCAVENavigator // placed under it: caveNavigator navigatorUser0(fly(off)) // A ygHead node establishes the transform associated with the head of the user. // The position and orientation of this transform is updated by the tracked position // sensor attatched to user goggles: caveTracker headTrackerUser0() { head headUser0() object headAvatarUser0(file(avatarHead.pfb,false),draw(remote)) } // Any object placed under the ygCAVEHead node will appear to move in concert with the // head of the associated user. An avatar head object helps to establish the user // avatar in multi-user environments. // // A ygCAVETracker node is used to establish a transform updated by any one of the other // tracked position sensors available: caveTracker wandTrackerUser0(sensor(1)) { caveWand wandUser0() object wandAvatarUser0(file(avatarHand.pfb)) } // Any object placed under the ygCAVETracker node of the wand position sensor will appear // to move in concert with that tracker. An avatar hand object helps to complete the user // avatar when the ygCAVETracker node is using the sensor attached to the wand. // // A ygCAVEWand node generates button events associated with the wand found in the CAVE // and should also be placed under a ygCAVETracker node. // // The body node keeps the body geometry located beneath the ygHead node body bodyUser0() { object bodyAvatarUser0(file(avatarBody.pfb,false),draw(remote)) } // The keyboard node is used to setup the keyboard for toggle collision and fly modes keyboard KBUser0(when(ckey, User0.toggleCollide),when(fkey, User0.toggleFly)) mathematics leftRangeUser0(startValues(-1 1 2 -45 -45 -45 3), endValues(-1.5 1.5 3 45 45 45 10), when(changed,leftTimerUser0.duration($value6), leftTimerUser0.event(switch), leftTimerUser0.endValues($values0 $values1 $values2 $values3 $values4 $values5))) timer leftTimerUser0(start, when(switch,startValues($endValues0 $endValues1 $endValues2 $endValues3 $endValues4 $endValues5)), when(changed,leftHandUser0.position($value0 $value1 $value2), leftHandUser0.orientation($value3 $value4 $value5)), when(end,leftRangeUser0.rand,start)) transform leftHandUser0() { object(file(avatarLeftHand.pfb)) } scene(file(widget_arm.yg), body.transform(bodyUser0), wand.transform(wandTrackerUser0)) scene(file(widget_arm.yg), body.transform(bodyUser0), wand.transform(leftHandUser0), shoulder.position(-1 0 1), shoulder.orientation(0 180 0)) scene(file(widget_velocity.yg), velocity.when(changed,velocityUser0.set($value))) value velocityUser0(when(changed,rightLeg.message(velocity_.set($value)), leftLeg.message(velocity_.set($value))), when(start,$node.message(pace.event(start)))) } scene rightLeg(file(widget_leg.yg), pace.start, pace.when(end,velocityUser0.event(start,node=leftLeg)), user.transform(user0), body.transform(bodyUser0)) scene leftLeg(file(widget_leg.yg), pace.when(end,velocityUser0.event(start,node=rightLeg)), user.transform(user0), body.transform(bodyUser0), hip.position(-1 0 0))