Multi-stage object animations with responders?

If you feel like you're up to the challenge of building your own Ages in Blender or 3ds Max, this is the place for you!

Multi-stage object animations with responders?

Postby tachzusamm » Thu Oct 13, 2011 8:56 am

Assumed I have an elevator.
This goes up an down, for example using this AlcScript, which defines a responder with actions for up and down:
Code: Select all
Elevator:
    animations:
      - name: EL_Anim
        autostart: 0
        loop: 0
    logic:
        actions:
          - type: responder
            name: EL_Move
            responder:
                states:
                  - cmds:               # Resp.Action 1: Elevator UP
                      - type: animcmdmsg
                        params:
                            receivers:   
                              - 006D:Elevator
                            animname: EL_Anim
                            cmds:
                              - setforewards
                              - continue
                        waiton: -1
                    nextstate: 1
                    waittocmd: 0
            
                  - cmds:               # Resp.Action 2: Elevator DOWN
                      - type: animcmdmsg
                        params:
                            receivers:   
                              - 006D:Elevator
                            animname: EL_Anim
                            cmds:
                              - setbackwards
                              - continue
                        waiton: -1
                    nextstate: 0
                    waittocmd: 0
            
                curstate: 0
                flags:
                  - detecttrigger

No problem with this. The "down" animation part is simply the up animation reversed (- setbackwards).

BUT: What if I want an Elevator which can move to Level 1, 2 and 3, so it can move from 1 to 2, from 2 to 3, and from 3 to 1?
In other words, is it possible to define this using properly set responders and animations, or do I have to control it with Python?
(Actually I do know how I could do it with Python, just wondering if responders are an alternative here.)

The main problem is not how to define the responders, but how I could define the animation.
In other words, how could I define that there's a stop at level 2?


Edit: I should clarify this. With stop at level 2 I mean, the animation triggered by the first responder action completely stops here and does not continue until a next responder action is called (e.g. triggered by a region or button), which then makes the thing move from 2 to 3.

Code: Select all
                            cmds:
                              - setforewards
                              - continue

always play from start to end. So how could I tell it to play only part of the animation in AlcScript?
User avatar
tachzusamm
 
Posts: 575
Joined: Thu May 29, 2008 2:03 am
Location: Germany

Re: Multi-stage object animations with responders?

Postby D'Lanor » Thu Oct 13, 2011 9:50 am

You can cut an animation into pieces based on start and end times, plus the fact that any animation in Plasma runs at 30 frames per second. Animations defined this way should run independently (but of course not simultaneously). So in this example...
Code: Select all
Elevator:
    animations:
      - name: EL_Anim_0_to_1
        autostart: 0
        loop: 0
        loopstart: 0
        loopend: 10
      - name: EL_Anim_1_to_2
        autostart: 0
        loop: 0
        loopstart: 10
        loopend: 20
      - name: EL_Anim_2_to_3
        autostart: 0
        loop: 0
        loopstart: 20
        loopend: 30

...EL_Anim_0_to_1 runs from frame 1 to 300, EL_Anim_1_to_2 from frame 300 to 600 and EL_Anim_2_to_3 from frame 600 to 900.

You will probably still need Python to set up the logic that determines when each animation should run because these three (or six if you count backwards movement) animations will just as easily run out of sequence, which would make your elevator warp.
Or maybe it is possible to build this kind of logic into your Alcscript with a system that enables/disables the activators at the correct moment.
"It is in self-limitation that a master first shows himself." - Goethe
User avatar
D'Lanor
 
Posts: 1980
Joined: Sat Sep 29, 2007 4:24 am

Re: Multi-stage object animations with responders?

Postby tachzusamm » Thu Oct 13, 2011 4:00 pm

Hey, this is really nice, thank you.
I assumed that loopstart and -end are used for loops only. Good to know that we can "split" animations into parts this way.

Exactly what I was looking for. Great!
User avatar
tachzusamm
 
Posts: 575
Joined: Thu May 29, 2008 2:03 am
Location: Germany


Return to Building

Who is online

Users browsing this forum: No registered users and 6 guests