//
import improv.actor.*; import improv.actor.behavior.*; import improv.util.*; public class ned extends Actors { private Layer background,layer1; public void addActors() { Actor ned = addActor("Ned"); // Create Channels; SFRotationChannel bodyRot = (SFRotationChannel) addChannel("Body","set_rotation"); SFRotationChannel headRot = (SFRotationChannel) addChannel("Head","set_rotation"); SFRotationChannel leftEyeRot = (SFRotationChannel) addChannel("LeftEye","set_rotation"); SFRotationChannel leftEyeStalkRot = (SFRotationChannel) addChannel("LeftEyeStalk","set_rotation"); SFVec3fChannel leftPupilScale = (SFVec3fChannel) addChannel("LeftPupil","set_scale"); SFRotationChannel rightEyeRot = (SFRotationChannel) addChannel("RightEye","set_rotation"); SFRotationChannel rightEyeStalkRot = (SFRotationChannel) addChannel("RightEyeStalk","set_rotation"); SFVec3fChannel rightPupilScale = (SFVec3fChannel) addChannel("RightPupil","set_scale"); SFRotationChannel rootRot = (SFRotationChannel) addChannel("ROOT","set_rotation"); SFVec3fChannel rootTrans = (SFVec3fChannel) addChannel("ROOT","set_translation"); // Add the layers & states State bg,lookLeft,lookRight,forward,eyesIn,eyesLeft,eyesRight; background = ned.addLayer("Background"); background.addBehavior(bg = new State("Background")); bg.addFilter(new SFVec3fFilter(rootTrans,0,0,0)); bg.addFilter(new SFRotationFilter(rootRot,0,0,0)); bg.addFilter(new SFRotationFilter(bodyRot,0,0,0)); bg.addFilter(new SFRotationFilter(headRot,0,0,0)); bg.addFilter(new SFRotationFilter(leftEyeStalkRot,0,0,0)); bg.addFilter(new SFRotationFilter(rightEyeStalkRot,0,0,0)); bg.addFilter(new SFRotationFilter(leftEyeRot,0,0,0)); bg.addFilter(new SFRotationFilter(rightEyeRot,0,0,0)); bg.addFilter(new SFVec3fFilter(leftPupilScale,1,1,1)); bg.addFilter(new SFVec3fFilter(rightPupilScale,1,1,1)); layer1 = ned.addLayer("Layer 1"); layer1.addBehavior(new State("Default - Layer 1")); layer1.addBehavior(lookLeft = new State("Look Left")); lookLeft.addFilter(new SFRotationFilter(headRot,0,45,0)); NoiseCurve nx1 = new NoiseCurve(-20,20,1); NoiseCurve nz1 = new NoiseCurve(20,-20,1); lookLeft.addFilter(new SFRotationFilter(leftEyeStalkRot,nx1,null,nz1)); NoiseCurve nx2 = new NoiseCurve(20,-20,1); nx2.setOffset(.3); NoiseCurve nz2 = new NoiseCurve(-20,20,1); nz2.setOffset(.3); lookLeft.addFilter(new SFRotationFilter(rightEyeStalkRot,nx2,null,nz2)); layer1.addBehavior(lookRight = new State("Look Right")); lookRight.addFilter(new SFRotationFilter(headRot,0,-45,0)); lookRight.addFilter(new SFRotationFilter(leftEyeStalkRot,nx2,null,nz2)); lookRight.addFilter(new SFRotationFilter(rightEyeStalkRot,nx1,null,nz1)); } }