CAP 211 -
Interactive Design and Game Development
Chapter 37 - Simulating Physics-Based Motion with reactor
This lesson discusses reactor. Objectives important to
- The reactor utility
- Using collections
- reactor modifiers
- reactor objects
The chapter begins with an introduction to reactor, a built-in utility for 3DS Max. reactor (it is never capitalized) is a physics simulator. It helps model the physical interactions of objects and forces. Like the last chapter, we are now in a world in which objects can have hard surfaces. This is different from the models we have made previously that could easily pass through one another.
The text explains that reactor is accessible from the Utilities panel in 3DS Max, and it is also accessible from the reactor menu on the menu bar. You may hear the words reactor and Havok used interchangeably: Havok is the company that wrote the reactor program. 3DS Max 9 comes with the reactor version 1 (Havok 1) and reactor version 3 (Havok 3) engines. Note that only the reactor version 1 engine is suitable for soft objects like cloth and rope.
As usual, the text describes many rollouts and parameters associated with this feature. The big picture this time is the settings describe objects to the reactor engine, allowing it to cause the objects to be affected by the laws of physics. ("Ye canna change the laws o' physics, laws o' physics, laws o' physics,
Ye canna change the laws o' physics, laws o' physics, Jim.")
Tutorial Notes and Questions
Tutorial 1 (Filling a glass bowl):
(Warning: The last step in this sequence takes a long time to complete.)
- Open the indicated file.
- Create a new reactor concept: Rigid Body Collection. Tell it you want to add objects to the collection.
- Select and add all objects in the scene to the collection.
Question 1: Why all the objects, and not just the marbles that will fill the bowl?
- Follow the instructions for the bowl.
Question 2: What does unyielding mean here?
- Set the mass for the marbles as instructed.
- Preview the animation through reactor.
Question 3: Why can't you just scrub the timeline at this point?
- The text says to have reactor compute keyframes if everything looks fine.
Question 4: What would you change if it did not look fine?
In the tutorial above, you used a collection. The text goes on to describe other collection types. As you will have noticed, adding an object to a collection give the object physical properties from the collection.
- rigid body collection - resists force (solid objects)
- cloth collection - bends to all forces (like normal cloth, not chain mail)
- soft body collection - flexes to force (think of a teddy bear or a Nerf ball)
- rope collection - supports tension (you can pull it), does not support compression (you can't push it)
- deforming mesh collection - deforms (changes shape) when acted on by forces (think of silly putty). Used for character meshes.
The text notes that the flexible types (everything except rigid) above are only as flexible as their number of segments allows. Think of the lines between segments as being like hinges: more of them makes it easier to bend the object, or to bend a small portion of it. Think how much more flexible a finger would be if it had twenty joints in it, instead of the default one on a biped. In the same way, imagine throwing a blanket over a chair. If the blanket has four segments (2 by 2), it may as well be aluminum siding. If it has 400 (20 by 20), you get a much better drape of the fabric.
The text also advises us that we can add an object to multiple collections, but this will generate a warning when we preview the animation. Take this as an indicator that you usually want to include an object in just one collection.
The text also explains that we can't add an object to a cloth, rope, or soft body collection unless the object has an appropriate modifier showing that it belongs in such a collection. The modifier will have the same name as that type of collection. Instead of adding it to the object in the modifier list, select the object, open the reactor menu, and choose Apply Modifier. The modifiers have a purpose: they give you access to the vertices of the objects they are applied to, enabling you to modify reactor properties by vertex. They also add properties that relate to the type of modifier:
- cloth modifier properties - mass, friction, relative density, air resistance
- rope modifier properties - mass, thickness, friction, air resistance, spring (bungee cord)
- soft body modifier properties - mass, friction, stiffness, damping
Most modification of reactor properties will be done through the individual item, not the collection, although the reactor Property Editor will let you set the properties for several items together. Some properties to be aware of:
- mass - The text says this sets the heaviness of an object. More properly, it sets the density, the relative mass per volume, and the inertia, the resistance to force, of the object. Since the author tells us to study physics, we should know that mass and weight are not the same thing. An object in flight or free fall will still have mass and inertia, but its weight will be unimportant. Follow the link in the last sentence for a high school review of this physics concept.
- friction - The object's resistance to slipping and sliding.
- elasticity - The relative bounciness of the object.
- inactive - This means that reactor will not consider the object when solving the scene.
- disable all collisions - The object will not collide with other objects.
- unyielding - The object will not move in the scene.
- phantom - The object does not affect other objects.
Settings for the reactor version 3 only:
- shell - How far away from the object can we be and still have a collision?
- penetration - How far are objects allowed to penetrate this object? Setting this speeds up the solution.
- quality - How important is the object to the animation?
- Debris - low importance
- Moving - medium importance
- Critical - high importance; should not penetrate other objects
- Bullet - fast objects (not related to penetration)
The text brings up the concept of whether an object is concave or convex. Its definition is not clear. In general, convex objects curve out and concave objects curve in, but that's not good enough for a test. A satellite dish is concave because it has a big dimple, but that does not give you a valid test, either.
- Think of a sphere. You can connect any point in or on the sphere to any other point in or on the sphere with a straight line that does not leave the sphere. This makes it convex. The same test works for a cube, so to 3DS Max, a cube is convex as well.
- Think of a bowl. There are many points in and on the bowl that when connected by straight lines, the line is outside the the body of the bowl. For instance, consider the points connected by the arrow on the cereal bowl on the right. The arrow goes through open space that is not part of the bowl. This makes the bowl concave.
Why do we care? First, convex objects render faster, so we should use them when possible. Second, you want to know whether an object is concave or convex in order to set a collision boundary as described on page 900. Doing so will also speed up rendering. You probably care about rendering speed if you did the tutorial above which tied up your computer for an hour.
Tutorial 2 (Throwing a shirt over a chair):
- This tutorial reinforces the ideas presented so far. Open the file indicated in this step. Note that you have a floor, a chair, and a shirt in the scene.
- Follow the instructions to create a rigid body collection, and to add the floor and chair to it. Note that you do not have to add modifiers to the floor or chair to add them to this collection.
- Follow the instruction to make the floor and chair unyielding. Note the instruction to leave rigid body collector mode before starting the next step.
- Add a reactor cloth modifier to the shirt as instructed. Note that this is required in order to add the shirt to a cloth collection.
- Follow the instructions to use a new method: create a cloth collection, but do it with the shirt already selected to automatically add the shirt to the collection.
- As you did in the last tutorial, bring up the preview window, wait, and then press P to preview the animation. (Don't get in a hurry.)
- If the last step worked, follow instructions in this step to create the animation. Again, it will take a while to complete.
The text turns to creating reactor objects. Nine reactor object types are listed on page 902. I found the text's lack of a definition for "dashpot" irritating. The article on Wikipedia is more enlightening. It may be easiest to think of the device on a screen door that prevents the door from slamming shut as an example of a a dashpot.
- spring - links two objects, a parent and a child, to pull them toward each other
- plane - presents a surface that rigid body objects cannot penetrate
- linear dashpot - links a parent and a child, acts like a shock absorber between them
- angular dashpot - links a parent and a child, acts like a shock absorber between them
- motor - spins rigid body objects
- wind - applies wind force to the scene; various setting simulate a variable wind
- toy car - applies to body and wheel objects in a scene to make them act like a car
- fracture - allows reactor objects to break and blow up
- water - represents a reactor version of water in the scene
Tutorial 3 (Driving a monster truck over a hill)
Tutorial 4 (Smashing a gingerbread house)
Tutorial 5 (Working with water)
- Pick one of the three tutorials above.
- Work together with at least one other student to do the tutorial.
- Turn in notes for the tutorial along with two questions and answers about it based on your observations.