[x3d-public] Back to Volunteering. Animation code.

John Carlson yottzumm at gmail.com
Wed Aug 9 22:35:45 PDT 2023


 Here's my current animation code.  I realize I don't have a way to "kick
off" the animation without user input yet, I am going to try to hook-up the
z100sTimer. The overall code tries to do run/jump/run/jump/... over 10
seconds, but only accomplishes running with a half-hearted jump between
runs (it cycles).  I did get some pretty wild contortions at one point,
even worse than before, Berzerker man!  Trying with R5 -z for now.

I don't really think this will scale to 11 chained animations and multiple
characters, but this is my current approach with one character.  I would
hope that X3D would provide something simpler that works well.

Andreas provided the ScalarInterpolator, but I haven't groked that yet.
I'm hoping I can inject a "TRUE" into an array of "FALSE"s for each take
for each character.   So that the startTime will get triggered when that
take is active.  I've had some experience with key/keyValue that I hope I
can take advantage of if I still have the code.


 #copied from existing code
    DEF Everything_Text Transform { translation 0 -12.2 0
       children [
        DEF Everything_Touch TouchSensor {  }
        DEF EverythingText Shape {
         appearance Appearance { material USE text_color }
         geometry Text { string ["Everything"]
          fontStyle FontStyle {
            family [ "SANS"  ]
          }
         }
        }
        DEF Everything_Back Shape {
         appearance Appearance { material USE Clear }
         geometry USE Backing
        }
       ]
      }
# Added by John

DEF EverythingAnimation Group {
 children [
DEF EverythingTimer TimeSensor { cycleInterval 10 loop TRUE enabled TRUE }
# set_bind "ToddlerView"
 ]
}

DEF myBooleanSequencer BooleanSequencer {
key [ 0 0.9 1.1 2.23 4.3 5.5 6.3 7.3 8.5 8.6 10 ]  #
Leif_humanoid_root_TranslationInterpolator x 10
keyValue [ TRUE FALSE TRUE FALSE TRUE FALSE TRUE FALSE TRUE FALSE TRUE ]
}

DEF myRunBooleanFilter BooleanFilter {
}

DEF myJumpBooleanFilter BooleanFilter {
}

DEF myJumpOnTimeTrigger TimeTrigger {
}

DEF myJumpOffTimeTrigger TimeTrigger {
}

DEF myRunOnTimeTrigger TimeTrigger {
}

DEF myRunOffTimeTrigger TimeTrigger {
}

ROUTE EverythingTimer.fraction_changed TO myBooleanSequencer.set_fraction

ROUTE myBooleanSequencer.value_changed TO myRunBooleanFilter.set_boolean
ROUTE myRunBooleanFilter.inputNegate TO myJumpBooleanFilter.set_boolean

ROUTE myRunBooleanFilter.inputFalse TO myRunOffTimeTrigger.set_boolean
ROUTE myRunBooleanFilter.inputTrue  TO myRunOnTimeTrigger.set_boolean
ROUTE myRunBooleanFilter.inputTrue  TO RunTimer.enabled

ROUTE myJumpBooleanFilter.inputFalse TO myJumpOffTimeTrigger.set_boolean
ROUTE myJumpBooleanFilter.inputTrue  TO myJumpOnTimeTrigger.set_boolean
ROUTE myJumpBooleanFilter.inputTrue TO JumpTimer.enabled

ROUTE myJumpOnTimeTrigger.triggerTime TO JumpTimer.startTime
ROUTE myJumpOffTimeTrigger.triggerTime TO JumpTimer.stopTime

ROUTE myRunOnTimeTrigger.triggerTime TO RunTimer.startTime
ROUTE myRunOffTimeTrigger.triggerTime TO RunTimer.stopTime

ROUTE Everything_Touch.touchTime TO StandTimer.stopTime
ROUTE Everything_Touch.touchTime TO PitchTimer.stopTime
ROUTE Everything_Touch.touchTime TO YawTimer.stopTime
ROUTE Everything_Touch.touchTime TO RollTimer.stopTime
ROUTE Everything_Touch.touchTime TO WalkTimer.stopTime
ROUTE Everything_Touch.touchTime TO KickTimer.stopTime
ROUTE Everything_Touch.touchTime TO StopTimer.stopTime
ROUTE Everything_Touch.touchTime TO RunTimer.stopTime
ROUTE Everything_Touch.touchTime TO JumpTimer.stopTime
ROUTE Everything_Touch.touchTime TO EverythingTimer.startTime
# done, John
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20230810/e821941e/attachment.html>


More information about the x3d-public mailing list