Inventor - how to animate a transformation?

Inventor - how to animate a transformation?

Post by Cvmall » Tue, 02 May 1995 04:00:00



I'm working on my first substantial Inventor application and have a
general question:

        How can one use Engines to animate the transformation
        of an object from position A to position B?

As a specific example, suppose that my scene graph consists of an
SoTransform and
an SoShape.  Each time the user selects the SoShape, I want it to rotate a
certain amount
(by modifying the SoTransform) and then stop when the rotation reaches a
certain angle.
The rotation must be animated -- the SoShape should not jump to the new
position,
but should smoothly rotate to the new position.

I've been experimenting with various combinations of Engines, but none of
my combinations
do the trick, and all of them seem to be too complicated.  Since animating
a transformation
is something that's undoubtedly quite common, my guess is that there is a
simple/elegant
way to do this.

Any advice/assistance you can provide will be appreciated. Thanks!

-Chris Malley

 
 
 

Inventor - how to animate a transformation?

Post by Bruce Bail » Wed, 03 May 1995 04:00:00



writes:
|> I'm working on my first substantial Inventor application and have a
|> general question:
|>
|>         How can one use Engines to animate the transformation
|>         of an object from position A to position B?
|>
|> As a specific example, suppose that my scene graph consists of an
|> SoTransform and
|> an SoShape.  Each time the user selects the SoShape, I want it to rotate
|> a
|> certain amount
|> (by modifying the SoTransform) and then stop when the rotation reaches
|> a
|> certain angle.
|> The rotation must be animated -- the SoShape should not jump to the new
|> position,
|> but should smoothly rotate to the new position.
|>
|> I've been experimenting with various combinations of Engines, but none
|> of
|> my combinations
|> do the trick, and all of them seem to be too complicated.  Since
|> animating
|> a transformation
|> is something that's undoubtedly quite common, my guess is that there is
|> a
|> simple/elegant
|> way to do this.
|>
|> Any advice/assistance you can provide will be appreciated. Thanks!
|>
|> -Chris Malley

How about using a Rotor (self-animating rotation) node, fed by
a OneShot Engine to control the duration which the Rotor is active?
The following example is a bit of a kludge due to the "button",
or trigger being a dragger, but hopefully it illustrates the point.

Store this as a file, e.g., pivot.iv and then run

  ivview -q pivot.iv

or

  /usr/demos/Inventor/SceneViewer pivot.iv

Switch to picking mode (click on the arrow icon in the upper right
hand corner of the viewer) and click on the cube to invoke the
rotation.

#Inventor V2.0 ascii

Separator {
    Rotor {
        speed .15
        on FALSE = OneShot {
            duration 2
            trigger = DEF ON_BUTTON ScaleUniformDragger {
                scaler Separator { DEF GEOM Cube {} }
                scalerActive Separator {
                    Material { diffuseColor 1 1 0 }
                    USE GEOM
                }
            }.isActive
        }.isActive
    }
    USE ON_BUTTON

Quote:}

--
-------------------------------------------------------------------

Systems Engineer                     tel: (303) 796-0022
Silicon Graphics                     fax: (303) 796-0438
4600 South Ulster Street, #820       vmail box:   5-8403
Denver, CO  80237
-------------------------------------------------------------------