Search form

'Building Interactive Worlds in 3D': Importing a Character

VFXWorld presents a new excerpt from Building Interactive Worlds in 3D by Jean-Marc Gauthier. This month, from the Basic 3D Kit, we present a tutorial how to import a character.

All images from Building Interactive Worlds in 3D: Virtual Sets and Pre-Visualization for Games, Film & the Web by Jean-Marc Gauthier. Reprinted with permission.

This is the latest in a series of excerpts from Building Interactive Worlds in 3D by Jean-Marc Gauthier. This month is the last excerpt we will present from the section entitled The Basic 3D Kit.

Lets import Mr. Cyclop.mno, the character created in the previous tutorial.

Go to the top menu and select Resource > Import File As > Character. Go to the Level Manager. Check Characters > Cyclop subfolder, where you can find Mr. Cyclops body parts, bones and animations.

Please note that you need to export Cyclop as a character in Maya if you want to use Cyclop as a character in Virtools. If you cant get Virtools to recognize Cyclop as a character, go to Maya and repeat the steps from Section 2.6.

The Character Stands on the Floor

Lets make our character stand on the floor. This may be critical when your character stands on an uneven surface, such as a hill. The character is going to receive a force of attraction similar to gravity. You need to prevent the character from falling across the ground.

Lets see how you can declare that the ground is a Floor, add gravity to the scene and keep the character standing on the ground.

To Add the Floor Attribute to the 3D Object Called Ground:

Go to the Level Manager > Level > Global > 3D Objects > Ground. Ground is what we called the plane created in Maya in Section 3.1 of this tutorial.

Double click on Ground. A new tab will open with the 3D Object setup. Click on the Attribute button. Click on the Add Attribute button.

The Add Attribute dialog box opens. Select Floor Manager > Floor. Click Add Attribute. Click Add Selected and close the window.

Adding the Floor attribute to the 3D Object called Ground.

To Set Up the Character on the Floor

Go to Building Blocks, located on the right side of 3D Layout. Select Characters > Constraint Folder > Character Keep on Floor.

This building block looks for any obstacle or 3D Object with a floor attribute. The behavior will add gravity to the character and keep the character standing on the floor.

Please note that because the behavior is activated only during playback, the initial position of a character with Keep on Floor behavior should be slightly above ground.

The Character Walks

Lets get our character to walk around. Remember to set Initial Condition for your character before starting. The interactive animation setup for Mr. Cyclop has two steps:

Creating an Interactive Walk Animation for Mr. Cyclop

Go to Building Blocks, located on the right side of 3D Layout. Select Characters > Movement > Character Controller.

A Character Controller dialog window opens. Select Walk Animation = cyclop_walk animation. Click OK.

Controlling the Walk Animation for Mr. Cyclop

Go to Building Blocks, located on the right side of 3D Layout. Select Controllers > Keyboard > Keyboard Controller.

Drag the Building Block over the character in 3D Layout. The character is highlighted with a yellow bounding box. The Keyboard Controller Building Block uses the numeric keys 8 and 6 for playing animations and the numeric keys 2 and 4 for turning the character to the right or to the left.

Creating an interactive walk animation for Mr. Cyclop.

In this example, press key 8 to trigger the walk animation.

Play the application, and check the walk animation by pressing the numeric key 8. Your Cyclop stays on the floor and walks. Press keys 2 and 4 to turn the Cyclop.

To save your creation as a cmo file, go to File > Save Composition. To bring the application into the Virtools web player, you can publish a compressed .vmo file, embedded inside a web page.

Go to File > Create a Web Page. Choose the window size for your 3D interactive content and select Preview in Browser.

Virtools generates a Virtools Web player file with .vmo extension, and a Web page with .html extension. The Web page contains the code to embed the Web player file.

So this is it! Congratulations on completing your interactive 3D application.

What Did You Learn in This Tutorial?

This tutorial showed you how to create a small forest in Maya and how to export 3D objects with their textures from Maya to Virtools. You learned how to set up an animated character inside a 3D interactive scene and how to get the character to walk around.

This chapter gave you a roadmap of how to produce 3D interactive content. The next chapter about kinematics will show you how to create virtual worlds with elements similar to the ones from this basic 3D kit. You will find more possibilities for interaction between the character and the forest. You will animate the forest. Mr. Cyclop will find ways to avoid obstacles on his way and he will also play music with the trees.

Find more turnkey tutorials that detail all the steps required to build simulations and interactions in Building Interactive Worlds in 3D: Virtual Sets and Pre-Visualization for Games, Film & the Web by Jean-Marc Gauthier: Focal Press, 2005. 422 pages with illustrations. ISBN 0-240-80622-0 ($49.95). Check back to VFXWorld frequently to read new excerpts.

Jean-Marc Gauthier teaches at New York University in the graduate studies department of Interactive Telecommunications and is the author of Interactive 3D Actors and Their Worlds (Morgan Kaufmann Publishers 2000). He is also a consultant at www.tinkering.net and an award-winning 3D artist.

Tags 
randomness