Математика

Физика

Химия

Биология

Техника и    технологии

Общий алгоритм анимации

Box Transformations

1.Создания объекта с параметрами

The following lines prepare our box for more complex transformations. They change the number of box segments on all sides, and put a check mark into the Generate Mapping Coords. box in the Parameters rollout:

MAXScript has changed the appropriate settings in the Parameters rollout:
 

Enter the following four lines of code:
 
  mybox=box()
   mybox.length=20

   mybox.Width=20
   mybox.Height=20

mybox.lengthsegs = 10
mybox.widthsegs = 10
mybox.heightsegs = 10

mybox.mapCoords = true

Результат

Any time you change a property of a 3ds Max object, MAXScript immediately reflects the change in the scene and in the user interface.

You can also create modifiers and add them to an object.

2.Creating and Assigning Modifiers

The box in your Perspective viewport is now twisted and the interface shows the new Twist modifier in the modifier stack display, together with its parameters:
 

Creating a modifier is pretty simple. You use the addModifier command and specify the name of the modifier you want to use and its appropriate parameters.

To create a Twist modifier set at 30 degrees and apply it to your box, you would enter

For example,

addModifier mybox (twist angle:30)

Результат
 

Changing a Modifier

The twist of your box is now more pronounced and the Angle parameter of the Twist modifier displays the new value:
 

Changing a modifier is similar to changing a creation parameter. Again, because you used a variable name for your object, and you added a modifier to that object variable, you now have easy access to the new modifier properties of your object.
 To change the angle of the twist modifier to 60 degrees,

enter

mybox.twist.angle = 60

Animating the Box

 

MAXScript has several syntax forms that mirror the main UI tools, such as the Auto Key button, the time slider, and the active coordinate system. In the following example, you turn on the Auto Key button, set the slider to several different values, and adjust the properties of your box, just as you would do using the software’s UI:
 
animate on

(

at time 0 (mybox.pos = [-100, 0, 0]; mybox.scale = [1, 1, 0.25])

at time 100 (mybox.pos = [100, 0, 0]; mybox.scale = [1, 1, 3])

)

Drag the slider around, and you will see that MAXScript has animated the box, and placed keyframes at 0 and 100.

When you use MAXScript to animate objects, the actual Auto Key button in the UI does not come on, nor does the time slider move; these things happen within MAXScript.

In this example, the time was given as a simple number. If no unit is specified, MAXScript interprets this as a frame number. You can also use one of the various time literals in the following manner:

2.5s -- 2.5 seconds

20f -- 20 frames

4800t -- 4800 ticks = 1 sec

1m3s5f -- 1 min, 3 seconds, 5 frames

1:15.5 -- SMPTE: 1 min, 15 seconds, 5 frames

Note:

All times are automatically converted to frames.

 

Historical Note:

In 3ds Max version 2 and 3, the User Interface featured a button called Animate which performed the same function as the current Auto Key button. For this historical reason, the MAXScript context for creating animations is called Animate and not Autokey...

Назад

 

 На главную страницу

 

Hosted by uCoz