RIGGING TO MOVE AND ROTATE AN EGG IN 3DS MAX USING MAXSCRIPT

53 votes
Date Updated: 
05/24/2010
Author: 
H-Sapiens MartiEscageda Sayo-Samy MarlonRabago EdilbertoMendez

<!-- @page { margin: 2cm } P { margin-bottom: 0.21cm } A:link { so-language: zxx } -->

UNIVERSITY: UNIVERSIDAD LA SALLE NOROESTE

SUBJECT: ANIMACIÓN IV

INSTRUCTOR: ENRIQUE ROSALES

STUDENTS: OMAR R. HERNÁNDEZ

MARTÍN SOTO

JENNIFER RÍOS

MARLON RÁBAGO

EDILBERTO MÉNDEZ

DATE: MAY THE 24th 2010

 

 

RIGGING TO MOVE AND ROTATE AN EGG IN 3DS MAX USING MAXSCRIPT

 

 

I INTRODUCTION:

 

Defining the Problem

 

When trying to animate a ball, is somehow easy because of the balance and the shape, but what about the shape of an egg? It's obviously not the same and it will not rotate equally, much less in an uneven terrain. Making the rig is not that difficult to do, the hardest part is to get the right idea. The goal of this rigging is to make the egg rotate while keeping it touching the ground automatically, so the animator only has to worry about the speed of the egg and the distance it travels.

 

Initially the egg rotates as a simple ball, but due to the peculiar shape of the egg, we need to place it on the ground by moving the Z position using MaxScript.

 

 

II SOLVING THE PROBLEM

 

The Solution

 

The egg has an unique shape, it does not have a geometric standard shape, it seems like an oval but it is not. It is wider on the bottom and more narrow on the top.

 

This solution is a bit rudimentary, but at the same time it allows you to optimize it in the future in a comfortable way. This script evaluates the lowest point of the egg in the Z axis and defines it as the one touching the ground, so later it pushes it up so the egg is over the ground.

 

First we need to have a shape of an egg, then you cover it with helper points, (the more points you have will be better the movement of the egg. If you have few points the egg will have rude movements and it will surpass the surface.)

Image 1 Egg Rig

Image 1

 

In this step we put points in a side of the egg. 14 points are used to cover one side (as shown in image 1), and a set of 12 points every 30 degrees, making a total of 146 points around the egg. In the image perspective, the egg has a perfect shape, so you will have your egg perfectly covered of helper points.

 

To make sure the egg rotates correctly in all directions, it is necessary to use this rotation script, found in the cuneytozdas's rolling ball tutorial, as show in image 2. Also, and very important, the egg is re-parented to a box, this is done so the egg can be moved in the “x” and “y” axis position.

Image 2 Egg Rig

Image2

 

 

Image 3. Shows the code explained in blocks of colors. Next is the explanation of each block.

 

Block number one is the first being called. It is in charge of creating a keyframe for the egg, then the function in block number 2 is called, this one is in charge of searching the points around the egg and store them in an array.

 

After that it goes back to block one. This cycle creates the keyframes in the range position that the animator specifies.

 

Now the function in block 3 is called. This time the variables that are going to be used are declared and assigned.

 

Then in block 4, the function searches for the point that has the lower z position.

 

Next is block 5, this one trows a virtual ray to determine the point where the egg touches the ground and then it obtains an object with the coordinate in the z axis needed.

 

The last block, number 6, subtracts the distance that there is in the z position of the egg from the point in the lower z position, and then it adds the position of the plane intersection to place the egg above the plane.

 

The remaining code is to create a visual interface of the creation of the animation so the animator can use the script.

 

 

 

 

Image 3 Egg Rig

Image 3

This Solution's Weak Points

 

This are the problems that we know this solution has:

 

1.- One of the problems that will occur is that, as we use helpers, if there is another one in the scene that is not a child of the egg, the script will still consider it in the logic. So this solution is not that accurate because of its dependency in the points and not in the curvature of the egg.

 

2.- If the ground is too inclined, the egg will pass trough it by its side. But anyway, in real life an egg rotating in a really uneven plane will crash.

 

3.- It was necessary to use a points envelope around the egg. This can be also be done from the vertex of a similar or equal egg model, but with low polygons. The use of less points to envelop the egg can cause a less realistic rotation and a bumping effect on the rotation, but an use of many points can cause a higher load to the CPU.

 

4.- The problem with the egg rotation, is that the rotation script uses history dependent calculations and the function used to change the axis and to rotate the egg is recursive. So, in order to obtain the rotation next of the next frame, the code has to recalculate the previous rotations until the beginning once again, in every new frame, because the recursion ends when the time or frame equals zero or when there is no rotation. This can bring a lot of problems when the animation lasts for a lot of frames and the system runs out of memory.

 

 

 

III CONCLUSIONS

 

We found a solution to the problem of rotating an egg the more realistic way as is could be in a simple way. Even if the solution has weak points, that can be easily optimized. Nevertheless, its a really good tool to make the animation of an egg.

 

Maybe the recursive nature of the function actually represent a huge load to the computer, and we have to always think in the optimal solutions.

You can also find this paper on my blog
and in my Deviant Art Account

 

 

IV REFERENCES AND LINKS

 

http://www.cuneytozdas.com/tutorials/maxscript/

3ds Max's Help.

C. Woods, A. Bicalho, C. Murray, 3DS Max 4, Anaya Multimedia.

Application Version: 
1.0
AttachmentSize
egg_rigg__rotation_uneven_terrain.zip307.5 KB
eggRoller.ms1.86 KB
Rigging_to_move_and_rotate_an_egg_in_3ds_max_using_MaxScript.pdf451.33 KB

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Yusuf_ES's picture

Rolling cube

Awsome script. Has done a superb job :)

The same technique can be applied to a "rolling cube"?

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.